mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
This prevents constraint errors when the specified category has already been set.
This commit is contained in:
@@ -47,7 +47,7 @@ class SetCategory implements ActionInterface
|
||||
$name = $this->action->action_value;
|
||||
$category = Category::firstOrCreateEncrypted(['name' => $name, 'user_id' => Auth::user()->id]);
|
||||
Log::debug('Will set category "' . $name . '" (#' . $category->id . ') on journal #' . $this->journal->id . '.');
|
||||
$this->journal->categories()->save($category);
|
||||
$this->journal->categories()->sync([$category->id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user