Pagination in Laravel is super easy. I simply go:
$posts = Post::where( .... );
$posts->paginate(20, ['ID', 'title', 'body'], ....);
I am trying to replace the ID,title,body array with: ID, title, LEFT(body, 200)
But Laravel doesn't accept that! I found out that I should use this instead:
connection()->raw('ID, title, LEFT(body, 200) AS body');
For this to work, but the paginate method only accepts an array. Is there a way around it?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2a9GHzg
via IFTTT
Aucun commentaire:
Enregistrer un commentaire