belongsTo('App\Models\Account'); } /** * @return mixed */ public function user() { return $this->belongsTo('App\Models\User')->withTrashed(); } /** * @return mixed */ public function vendor() { return $this->belongsTo('App\Models\Vendor')->withTrashed(); } /** * @return mixed */ public function getPersonType() { return PERSON_VENDOR_CONTACT; } /** * @return mixed|string */ public function getName() { return $this->getDisplayName(); } /** * @return mixed|string */ public function getDisplayName() { if ($this->getFullName()) { return $this->getFullName(); } else { return $this->email; } } /** * @return string */ public function getFullName() { if ($this->first_name || $this->last_name) { return $this->first_name.' '.$this->last_name; } else { return ''; } } }