jeudi 21 janvier 2016

Laravel Eloquent using paginate with whereIn

Hi I have a query that looks roughly like this

Comment::join('users', 'users.id', '=', 'comments.user_id')
    ->whereIn('comments.id', $ids)
    ->paginate(5);

where $ids is an array of comment ids. Changing the paginate to get() works but I want to use paginate as it returns many built-in useful results such as next_page_url etc. So how do I modify the query to utilize both whereIn and paginate together?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1RXCZuT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire