user()->first(); } public function getCommentsAttribute() { return $this->comments()->orderBy('id','desc')->get(); } public function getExpertAttribute() { return $this->expert()->first(); } public function getAdvertisementAttribute() { return $this->advertisement()->first(); } public function user() { return $this->belongsTo(User::class, 'user_id'); } public function expert() { return $this->belongsTo(Expert::class, 'expert_id'); } public function advertisement() { return $this->belongsTo(Advertisement::class, 'adv_id'); } public function protest() { return $this->hasMany(Protest::class, 'user_expert_id'); } public function comments() { return $this->morphMany(Comment::class,'commentable'); } }