The code:
$posts = Jumpsite::find($jid) ->posts() ->with(\'comments\') ->with(\'likes\') ->with(\
Just single change to get results of the count
In relation
public function getTotalLikesAttribute(){ return $this->hasMany('Like')->where('author_id',$this->author_id)->count(); }
In the view
$post->getTotalLikesAttribute()