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 standards that belong to the subject. */ public function standards(){ return $this->belongsToMany('Standard\Subject\Models\Standard'); } }