Skip to content

Firefly III: a personal finances manager

Would be nice to remove the references as well...

James Colee69e6c1ce890
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 2fbccbaa5b..f78478dde8 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -58,9 +58,9 @@ class Attachment extends Model
*/
public static function routeBinder(string $value): Attachment
{
- if ($guard->check()) {
+ if (auth()->check()) {
$attachmentId = intval($value);
- $attachment = $guard->user()->attachments()->find($attachmentId);
+ $attachment = auth()->user()->attachments()->find($attachmentId);
if (!is_null($attachment)) {
return $attachment;
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index b59f5f3902..ba013701ea 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -90,9 +90,9 @@ class Budget extends Model
*/
public static function routeBinder(string $value): Budget
{
- if ($guard->check()) {
+ if (auth()->check()) {
$budgetId = intval($value);
- $budget = $guard->user()->budgets()->find($budgetId);
+ $budget = auth()->user()->budgets()->find($budgetId);
if (!is_null($budget)) {
return $budget;
}
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index 39437a6d55..741e2706c3 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -51,11 +51,11 @@ class BudgetLimit extends Model
*/
public static function routeBinder(string $value): BudgetLimit
{
- if ($guard->check()) {
+ if (auth()->check()) {
$budgetLimitId = intval($value);
$budgetLimit = self::where('budget_limits.id', $budgetLimitId)
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
- ->where('budgets.user_id', $guard->user()->id)
+ ->where('budgets.user_id', auth()->user()->id)
->first(['budget_limits.*']);
if (!is_null($budgetLimit)) {
return $budgetLimit;
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 52e081c853..38f6e3712d 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -89,9 +89,9 @@ class Category extends Model
*/
public static function routeBinder(string $value): Category
{
- if ($guard->check()) {
+ if (auth()->check()) {
$categoryId = intval($value);
- $category = $guard->user()->categories()->find($categoryId);
+ $category = auth()->user()->categories()->find($categoryId);
if (!is_null($category)) {
return $category;
}
diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php
index d932f5e753..03ec4c5816 100644
--- a/app/Models/ExportJob.php
+++ b/app/Models/ExportJob.php
@@ -50,9 +50,9 @@ class ExportJob extends Model
*/
public static function routeBinder(string $value): ExportJob
{
- if ($guard->check()) {
+ if (auth()->check()) {
$key = trim($value);
- $exportJob = $guard->user()->exportJobs()->where('key', $key)->first();
+ $exportJob = auth()->user()->exportJobs()->where('key', $key)->first();
if (null !== $exportJob) {
return $exportJob;
}
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index aa6753a87e..e0ae998c58 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -67,9 +67,9 @@ class ImportJob extends Model
*/
public static function routeBinder(string $value): ImportJob
{
- if ($guard->check()) {
+ if (auth()->check()) {
$key = trim($value);
- $importJob = $guard->user()->importJobs()->where('key', $key)->first();
+ $importJob = auth()->user()->importJobs()->where('key', $key)->first();
if (null !== $importJob) {
// must have valid status:
if (!in_array($importJob->status, $importJob->validStatus)) {
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index 54fc765d6b..143e30f4e6 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -56,7 +56,7 @@ class LinkType extends Model
*/
public static function routeBinder(string $value): LinkType
{
- if ($guard->check()) {
+ if (auth()->check()) {
$linkTypeId = intval($value);
$linkType = self::find($linkTypeId);
if (null !== $linkType) {
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 2e1b661abd..2140c33b8b 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -67,11 +67,11 @@ class PiggyBank extends Model
*/
public static function routeBinder(string $value): PiggyBank
{
- if ($guard->check()) {
+ if (auth()->check()) {
$piggyBankId = intval($value);
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
- ->where('accounts.user_id', $guard->user()->id)->first(['piggy_banks.*']);
+ ->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
if (!is_null($piggyBank)) {
return $piggyBank;
}
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 4022236180..a59525674f 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -55,9 +55,9 @@ class Rule extends Model
*/
public static function routeBinder(string $value): Rule
{
- if ($guard->check()) {
+ if (auth()->check()) {
$ruleId = intval($value);
- $rule = $guard->user()->rules()->find($ruleId);
+ $rule = auth()->user()->rules()->find($ruleId);
if (!is_null($rule)) {
return $rule;
}
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 55c8422ea4..c57ebc4ad8 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -58,9 +58,9 @@ class RuleGroup extends Model
*/
public static function routeBinder(string $value): RuleGroup
{
- if ($guard->check()) {
+ if (auth()->check()) {
$ruleGroupId = intval($value);
- $ruleGroup = $guard->user()->ruleGroups()->find($ruleGroupId);
+ $ruleGroup = auth()->user()->ruleGroups()->find($ruleGroupId);
if (!is_null($ruleGroup)) {
return $ruleGroup;
}
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 0a43ac31ae..5f70bee39e 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -93,9 +93,9 @@ class Tag extends Model
*/
public static function routeBinder(string $value): Tag
{
- if ($guard->check()) {
+ if (auth()->check()) {
$tagId = intval($value);
- $tag = $guard->user()->tags()->find($tagId);
+ $tag = auth()->user()->tags()->find($tagId);
if (!is_null($tag)) {
return $tag;
}
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index b181ed07a1..304b45487f 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -60,7 +60,7 @@ class TransactionCurrency extends Model
*/
public static function routeBinder(string $value): TransactionCurrency
{
- if ($guard->check()) {
+ if (auth()->check()) {
$currencyId = intval($value);
$currency = self::find($currencyId);
if (!is_null($currency)) {
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 0048392a7d..985ee14906 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -88,9 +88,9 @@ class TransactionJournal extends Model
*/
public static function routeBinder(string $value): TransactionJournal
{
- if ($guard->check()) {
+ if (auth()->check()) {
$journalId = intval($value);
- $journal = $guard->user()->transactionJournals()->where('transaction_journals.id', $journalId)
+ $journal = auth()->user()->transactionJournals()->where('transaction_journals.id', $journalId)
->first(['transaction_journals.*']);
if (!is_null($journal)) {
return $journal;
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index 2568c98308..8d216cc8ae 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -46,13 +46,13 @@ class TransactionJournalLink extends Model
*/
public static function routeBinder(string $value): TransactionJournalLink
{
- if ($guard->check()) {
+ if (auth()->check()) {
$linkId = intval($value);
$link = self::where('journal_links.id', $linkId)
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')
- ->where('t_a.user_id', $guard->user()->id)
- ->where('t_b.user_id', $guard->user()->id)
+ ->where('t_a.user_id', auth()->user()->id)
+ ->where('t_b.user_id', auth()->user()->id)
->first(['journal_links.*']);
if (!is_null($link)) {
return $link;
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index 8c268cb0de..1ad60435b3 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -74,7 +74,7 @@ class TransactionType extends Model
*/
public static function routeBinder(string $type): TransactionType
{
- if (!$guard->check()) {
+ if (!auth()->check()) {
throw new NotFoundHttpException();
}
$transactionType = self::where('type', ucfirst($type))->first();