trigger = $trigger; $this->journal = $journal; } /** * @return bool */ public function triggered() { $fromAccountName = strtolower($this->journal->source_account->name); $search = strtolower($this->trigger->trigger_value); $part = substr($fromAccountName, 0, strlen($search)); if ($part == $search) { Log::debug('"' . $fromAccountName . '" starts with "' . $search . '". Return true.'); return true; } Log::debug('"' . $fromAccountName . '" does not start with "' . $search . '". Return false.'); return false; } /** * Checks whether this trigger will match all transactions * This happens when the trigger_value is empty * @return bool */ public function matchesAnything() { return $this->trigger->trigger_value === ""; } }