{ if ($this->currency_id) { return $this->currency_id; } if (!$this->account) { $this->load('account'); } return $this->account->currency_id ?: DEFAULT_CURRENCY; } public function getCounter($isQuote) { return $isQuote ? $this->quote_number_counter : $this->invoice_number_counter; } public function markLoggedIn() { $this->last_login = Carbon::now()->toDateTimeString(); $this->save(); } } Client::creating(function ($client) { $client->setNullValues(); }); Client::created(function ($client) { event(new ClientWasCreated($client)); }); Client::updating(function ($client) { $client->setNullValues(); }); Client::updated(function ($client) { event(new ClientWasUpdated($client)); });