Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Referring to Auth::user will not work from the command line.
James Cole0fe70dae17bc
diff --git a/app/Rules/Actions/AddTag.php b/app/Rules/Actions/AddTag.phpindex 1203ea1765..ef61c7dd77 100644--- a/app/Rules/Actions/AddTag.php+++ b/app/Rules/Actions/AddTag.php@@ -46,7 +46,7 @@ class AddTag implements ActionInterfacepublic function act(TransactionJournal $journal): bool{// journal has this tag maybe?- $tag = Tag::firstOrCreateEncrypted(['tag' => $this->action->action_value, 'user_id' => Auth::user()->id]);+ $tag = Tag::firstOrCreateEncrypted(['tag' => $this->action->action_value, 'user_id' => $journal->user->id]);$count = $journal->tags()->where('tag_id', $tag->id)->count();if ($count == 0) {diff --git a/app/Rules/Actions/RemoveTag.php b/app/Rules/Actions/RemoveTag.phpindex eaab0bb1e9..d3ebaf93bd 100644--- a/app/Rules/Actions/RemoveTag.php+++ b/app/Rules/Actions/RemoveTag.php@@ -48,7 +48,7 @@ class RemoveTag implements ActionInterface// if tag does not exist, no need to continue:$name = $this->action->action_value;/** @var Tag $tag */- $tag = Auth::user()->tags()->get()->filter(+ $tag = $journal->user->tags()->get()->filter(function (Tag $tag) use ($name) {return $tag->tag == $name;}diff --git a/app/Rules/Actions/SetCategory.php b/app/Rules/Actions/SetCategory.phpindex 848dec089e..ef833e6278 100644--- a/app/Rules/Actions/SetCategory.php+++ b/app/Rules/Actions/SetCategory.php@@ -46,7 +46,7 @@ class SetCategory implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$name = $this->action->action_value;- $category = Category::firstOrCreateEncrypted(['name' => $name, 'user_id' => Auth::user()->id]);+ $category = Category::firstOrCreateEncrypted(['name' => $name, 'user_id' => $journal->user->id]);$journal->categories()->sync([$category->id]);return true;