. */ declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; use FireflyIII\Models\Note; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** * Class ClearNotes. */ class ClearNotes implements ActionInterface { /** @var RuleAction The rule action */ private $action; /** * TriggerInterface constructor. * * @param RuleAction $action */ public function __construct(RuleAction $action) { $this->action = $action; } /** * Remove notes * * @param TransactionJournal $journal * * @return bool */ public function act(TransactionJournal $journal): bool { Log::debug(sprintf('RuleAction ClearNotes removed all notes.')); $notes = $journal->notes()->get(); /** @var Note $note */ foreach ($notes as $note) { $note->delete(); } return true; } }