. */ declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** * Class ClearCategory * * @package FireflyIII\TransactionRules\Action */ class ClearCategory implements ActionInterface { private $action; /** * TriggerInterface constructor. * * @param RuleAction $action */ public function __construct(RuleAction $action) { $this->action = $action; } /** * @param TransactionJournal $journal * * @return bool */ public function act(TransactionJournal $journal): bool { $journal->categories()->detach(); Log::debug(sprintf('RuleAction ClearCategory removed all categories from journal %d.', $journal->id)); return true; } }