morphTo(__FUNCTION__, 'user_type', 'user_id'); } /** * Check if the current user is the owner of the advert. * * @return bool */ public function getIsOwnerAttribute() : bool { if ($this->client_id == user_id() && Client::class == user_type()) { return true; } if ($this->user_id == user_id() && $this->user_type == user_type()) { return true; } return false; } /** * The assets that belong to the user. */ public function assets(){ return $this->hasMany('Asset\User\Models\Asset'); } }