Skip to content

Firefly III: a personal finances manager

Remove reference to guard from models.

James Cole53a6c10ada71
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 75e97e7cfd..ddcd8e9a0c 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -118,11 +118,11 @@ class Account extends Model
*
* @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);
- $account = $guard->user()->accounts()->find($accountId);
+ $account = auth()->user()->accounts()->find($accountId);
if (!is_null($account)) {
return $account;
}
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 5c0b2a841c..2fbccbaa5b 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -56,7 +56,7 @@ class Attachment extends Model
*
* @return Attachment
*/
- public static function routeBinder($guard, string $value): Attachment
+ public static function routeBinder(string $value): Attachment
{
if ($guard->check()) {
$attachmentId = intval($value);
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 9b3a94af90..ec09d0fcc7 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -73,11 +73,11 @@ class Bill extends Model
*
* @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);
- $bill = $guard->user()->bills()->find($billId);
+ $bill = auth()->user()->bills()->find($billId);
if (!is_null($bill)) {
return $bill;
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 05c5928569..b59f5f3902 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -88,7 +88,7 @@ class Budget extends Model
*
* @return Budget
*/
- public static function routeBinder($guard, string $value): Budget
+ public static function routeBinder(string $value): Budget
{
if ($guard->check()) {
$budgetId = intval($value);
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index 2738cd1cb0..39437a6d55 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -49,7 +49,7 @@ class BudgetLimit extends Model
*
* @return mixed
*/
- public static function routeBinder($guard, string $value): BudgetLimit
+ public static function routeBinder(string $value): BudgetLimit
{
if ($guard->check()) {
$budgetLimitId = intval($value);
diff --git a/app/Models/Category.php b/app/Models/Category.php
index cdede7e5eb..52e081c853 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -87,7 +87,7 @@ class Category extends Model
*
* @return Category
*/
- public static function routeBinder($guard, string $value): Category
+ public static function routeBinder(string $value): Category
{
if ($guard->check()) {
$categoryId = intval($value);
diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php
index 6968664ce0..d932f5e753 100644
--- a/app/Models/ExportJob.php
+++ b/app/Models/ExportJob.php
@@ -48,7 +48,7 @@ class ExportJob extends Model
*
* @throws NotFoundHttpException
*/
- public static function routeBinder($guard, string $value): ExportJob
+ public static function routeBinder(string $value): ExportJob
{
if ($guard->check()) {
$key = trim($value);
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index 530af07f2e..aa6753a87e 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -65,7 +65,7 @@ class ImportJob extends Model
* @throws NotFoundHttpException
* @throws FireflyException
*/
- public static function routeBinder($guard, string $value): ImportJob
+ public static function routeBinder(string $value): ImportJob
{
if ($guard->check()) {
$key = trim($value);
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index 6a44ea96e9..54fc765d6b 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -54,7 +54,7 @@ class LinkType extends Model
*
* @throws NotFoundHttpException
*/
- public static function routeBinder($guard, string $value): LinkType
+ public static function routeBinder(string $value): LinkType
{
if ($guard->check()) {
$linkTypeId = intval($value);
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index f943398653..2e1b661abd 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -65,7 +65,7 @@ class PiggyBank extends Model
*
* @return PiggyBank
*/
- public static function routeBinder($guard, string $value): PiggyBank
+ public static function routeBinder(string $value): PiggyBank
{
if ($guard->check()) {
$piggyBankId = intval($value);
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index b21f1f2147..4022236180 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -53,7 +53,7 @@ class Rule extends Model
*
* @return Rule
*/
- public static function routeBinder($guard, string $value): Rule
+ public static function routeBinder(string $value): Rule
{
if ($guard->check()) {
$ruleId = intval($value);
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 28a15ecead..55c8422ea4 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -56,7 +56,7 @@ class RuleGroup extends Model
*
* @return RuleGroup
*/
- public static function routeBinder($guard, string $value): RuleGroup
+ public static function routeBinder(string $value): RuleGroup
{
if ($guard->check()) {
$ruleGroupId = intval($value);
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 81b44ad1e0..0a43ac31ae 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -91,7 +91,7 @@ class Tag extends Model
*
* @return Tag
*/
- public static function routeBinder($guard, string $value): Tag
+ public static function routeBinder(string $value): Tag
{
if ($guard->check()) {
$tagId = intval($value);
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index 390dff6906..b181ed07a1 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -58,7 +58,7 @@ class TransactionCurrency extends Model
*
* @return TransactionCurrency
*/
- public static function routeBinder($guard, string $value): TransactionCurrency
+ public static function routeBinder(string $value): TransactionCurrency
{
if ($guard->check()) {
$currencyId = intval($value);
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 9cc480fcf4..0048392a7d 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -86,7 +86,7 @@ class TransactionJournal extends Model
*
* @return TransactionJournal
*/
- public static function routeBinder($guard, string $value): TransactionJournal
+ public static function routeBinder(string $value): TransactionJournal
{
if ($guard->check()) {
$journalId = intval($value);
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index 1154b85187..2568c98308 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -44,7 +44,7 @@ class TransactionJournalLink extends Model
*
* @throws NotFoundHttpException
*/
- public static function routeBinder($guard, string $value): TransactionJournalLink
+ public static function routeBinder(string $value): TransactionJournalLink
{
if ($guard->check()) {
$linkId = intval($value);
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index a803fc4e1e..8c268cb0de 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -72,7 +72,7 @@ class TransactionType extends Model
*
* @return Model|null|static
*/
- public static function routeBinder($guard, string $type): TransactionType
+ public static function routeBinder(string $type): TransactionType
{
if (!$guard->check()) {
throw new NotFoundHttpException();