mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Remove reference to guard from models.
This commit is contained in:
		| @@ -118,11 +118,11 @@ class Account extends Model | |||||||
|      * |      * | ||||||
|      * @return Account |      * @return Account | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Account |     public static function routeBinder(string $value): Account | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if (auth()->check()) { | ||||||
|             $accountId = intval($value); |             $accountId = intval($value); | ||||||
|             $account   = $guard->user()->accounts()->find($accountId); |             $account   = auth()->user()->accounts()->find($accountId); | ||||||
|             if (!is_null($account)) { |             if (!is_null($account)) { | ||||||
|                 return $account; |                 return $account; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ class Attachment extends Model | |||||||
|      * |      * | ||||||
|      * @return Attachment |      * @return Attachment | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Attachment |     public static function routeBinder(string $value): Attachment | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $attachmentId = intval($value); |             $attachmentId = intval($value); | ||||||
|   | |||||||
| @@ -73,11 +73,11 @@ class Bill extends Model | |||||||
|      * |      * | ||||||
|      * @return Bill |      * @return Bill | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Bill |     public static function routeBinder(string $value): Bill | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if (auth()->check()) { | ||||||
|             $billId = intval($value); |             $billId = intval($value); | ||||||
|             $bill   = $guard->user()->bills()->find($billId); |             $bill   = auth()->user()->bills()->find($billId); | ||||||
|             if (!is_null($bill)) { |             if (!is_null($bill)) { | ||||||
|                 return $bill; |                 return $bill; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ class Budget extends Model | |||||||
|      * |      * | ||||||
|      * @return Budget |      * @return Budget | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Budget |     public static function routeBinder(string $value): Budget | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $budgetId = intval($value); |             $budgetId = intval($value); | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ class BudgetLimit extends Model | |||||||
|      * |      * | ||||||
|      * @return mixed |      * @return mixed | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): BudgetLimit |     public static function routeBinder(string $value): BudgetLimit | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $budgetLimitId = intval($value); |             $budgetLimitId = intval($value); | ||||||
|   | |||||||
| @@ -87,7 +87,7 @@ class Category extends Model | |||||||
|      * |      * | ||||||
|      * @return Category |      * @return Category | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Category |     public static function routeBinder(string $value): Category | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $categoryId = intval($value); |             $categoryId = intval($value); | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ class ExportJob extends Model | |||||||
|      * |      * | ||||||
|      * @throws NotFoundHttpException |      * @throws NotFoundHttpException | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): ExportJob |     public static function routeBinder(string $value): ExportJob | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $key       = trim($value); |             $key       = trim($value); | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ class ImportJob extends Model | |||||||
|      * @throws NotFoundHttpException |      * @throws NotFoundHttpException | ||||||
|      * @throws FireflyException |      * @throws FireflyException | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): ImportJob |     public static function routeBinder(string $value): ImportJob | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $key       = trim($value); |             $key       = trim($value); | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ class LinkType extends Model | |||||||
|      * |      * | ||||||
|      * @throws NotFoundHttpException |      * @throws NotFoundHttpException | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): LinkType |     public static function routeBinder(string $value): LinkType | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $linkTypeId = intval($value); |             $linkTypeId = intval($value); | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ class PiggyBank extends Model | |||||||
|      * |      * | ||||||
|      * @return PiggyBank |      * @return PiggyBank | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): PiggyBank |     public static function routeBinder(string $value): PiggyBank | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $piggyBankId = intval($value); |             $piggyBankId = intval($value); | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ class Rule extends Model | |||||||
|      * |      * | ||||||
|      * @return Rule |      * @return Rule | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Rule |     public static function routeBinder(string $value): Rule | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $ruleId = intval($value); |             $ruleId = intval($value); | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ class RuleGroup extends Model | |||||||
|      * |      * | ||||||
|      * @return RuleGroup |      * @return RuleGroup | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): RuleGroup |     public static function routeBinder(string $value): RuleGroup | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $ruleGroupId = intval($value); |             $ruleGroupId = intval($value); | ||||||
|   | |||||||
| @@ -91,7 +91,7 @@ class Tag extends Model | |||||||
|      * |      * | ||||||
|      * @return Tag |      * @return Tag | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): Tag |     public static function routeBinder(string $value): Tag | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $tagId = intval($value); |             $tagId = intval($value); | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ class TransactionCurrency extends Model | |||||||
|      * |      * | ||||||
|      * @return TransactionCurrency |      * @return TransactionCurrency | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): TransactionCurrency |     public static function routeBinder(string $value): TransactionCurrency | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $currencyId = intval($value); |             $currencyId = intval($value); | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ class TransactionJournal extends Model | |||||||
|      * |      * | ||||||
|      * @return TransactionJournal |      * @return TransactionJournal | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): TransactionJournal |     public static function routeBinder(string $value): TransactionJournal | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $journalId = intval($value); |             $journalId = intval($value); | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ class TransactionJournalLink extends Model | |||||||
|      * |      * | ||||||
|      * @throws NotFoundHttpException |      * @throws NotFoundHttpException | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $value): TransactionJournalLink |     public static function routeBinder(string $value): TransactionJournalLink | ||||||
|     { |     { | ||||||
|         if ($guard->check()) { |         if ($guard->check()) { | ||||||
|             $linkId = intval($value); |             $linkId = intval($value); | ||||||
|   | |||||||
| @@ -72,7 +72,7 @@ class TransactionType extends Model | |||||||
|      * |      * | ||||||
|      * @return Model|null|static |      * @return Model|null|static | ||||||
|      */ |      */ | ||||||
|     public static function routeBinder($guard, string $type): TransactionType |     public static function routeBinder(string $type): TransactionType | ||||||
|     { |     { | ||||||
|         if (!$guard->check()) { |         if (!$guard->check()) { | ||||||
|             throw new NotFoundHttpException(); |             throw new NotFoundHttpException(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user