mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Referring to Auth::user will not work from the command line.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
parent
7079e76886
commit
0fe70dae17
@ -46,7 +46,7 @@ class AddTag implements ActionInterface
|
||||
public 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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class SetCategory implements ActionInterface
|
||||
public 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;
|
||||
|
Loading…
Reference in New Issue
Block a user