I'm using a raw SQL query in Laravel, because it was easier to me at the beginning to make complex queries, so I used them like that.
Now I want to get a list of comments of an user 7, and I would like to paginate the comments, in 5.
That's what I have:
$comments = DB::select( DB::raw("SELECT users.name, reviews.comment, reviews.comment_score FROM reviews JOIN users WHERE reviews.user_id = :logged_user;")
,array('logged_user' => $user_id,));
So this query depends on the user which is consulting the view, receives a variable.
All I see for pagination is with Eloquent queries, and I don't find any clear usage for this.
If I add '->paginate(5)' at the end of the last parenthesis, or later to the variable like $comments->paginate(5); I get a:
Error: Call to a member function paginate() on array
Some light on this??
Thanks a lot! =)