hasMany(PostComment::class, 'reply_id'); } /** * @return mixed */ public function user() { return $this->belongsTo(User::class); } /** * Returns user is commentable. */ public function getIsEditedAttribute() { return loggedInUser()->id === $this->user_id; } /** * Returns model in days since created_at. */ public function getCreatedAgoAttribute() { return $this->created_at->diffForHumans(); } /** * @return mixed */ public function post() { return $this->belongsTo(Post::class); } }