whereAccountId(Auth::user()->account_id); } public function account() { return $this->belongsTo('Account'); } public function invoices() { return $this->hasMany('Invoice'); } public function contacts() { return $this->hasMany('Contact'); } public function country() { return $this->belongsTo('Country'); } public function getName() { return $this->name; } public function getEntityType() { return ENTITY_CLIENT; } public function getAddress() { $str = ''; if ($this->address1) { $str .= $this->address1 . '
'; } if ($this->address2) { $str .= $this->address2 . '
'; } if ($this->city) { $str .= $this->city . ', '; } if ($this->state) { $str .= $this->state . ' '; } if ($this->postal_code) { $str .= $this->postal_code; } if ($this->country) { $str .= '
' . $this->country->name; } if ($str) { $str = '

' . $str . '

'; } return $str; } public function getPhone() { $str = ''; if ($this->work_phone) { $str .= '' . $this->work_phone; } return $str; } public function getNotes() { $str = ''; if ($this->notes) { $str .= '' . $this->notes . ''; } return $str; } public function getDateCreated() { if ($this->created_at == '0000-00-00 00:00:00') { return '---'; } else { return $this->created_at->format('m/d/y h:i a'); } } } Client::created(function($client) { Activity::createClient($client); });