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 users that belong to the asset. */ public function users(){ return $this->belongsToMany('Asset\Asset\Models\User'); } }