Expand search.

This commit is contained in:
James Cole
2020-08-24 07:03:17 +02:00
parent 4bf86500bd
commit 3141ec0406
10 changed files with 256 additions and 54 deletions

View File

@@ -57,6 +57,10 @@ class AddTag implements ActionInterface
/** @var TagFactory $factory */
$factory = app(TagFactory::class);
$factory->setUser($journal->user);
// TODO explode value on comma?
$tag = $factory->findOrCreate($this->action->action_value);
if (null === $tag) {

View File

@@ -84,7 +84,10 @@ class SetCategory implements ActionInterface
$user = User::find($journal['user_id']);
$search = $this->action->action_value;
$category = $user->categories()->where('name', $search)->first();
/** @var CategoryFactory $factory */
$factory = app(CategoryFactory::class);
$factory->setUser($user);
$category = $factory->findOrCreate(null, $search);
if (null === $category) {
Log::debug(sprintf('RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.', $journal['transaction_journal_id'], $search));