lundi 12 février 2018

Count list not updating

Ive got a list showing how many times something has been commented on the problem is that this list does not seem to updated when something new is commented on. Any ideas how i improve this so the list is live and i can get the 20 most commented results.

What i have so far

Tables: batsmen: id, name comments: id, title, comments, batsmen_id

Controller:

$batsmen = Batsmen::with('comments')->where('approved', '=', 1)->get()->take(25)->sortByDesc(function($commented)
{
    return $commented->comments->count();
});

Any idea how i make this so that the list updates after every comment.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire