I am trying to show all the blogs on one page but want to paginate them. The pagination works but the links don't seem to appear in the view. It keeps showing me this error:
Call to undefined method Illuminate\Database\Eloquent\Collection::links()
Here's the code:
public static function all()
{
return \ExpoPost::with('attachment')->published()->type('post')->orderBy('post_date')->paginate(5);
}
And in the view I am trying to do something like this
@foreach($posts as $post)
<p>{{$post->post_title}}</p>
@endforeach
<p>{{$posts->links()}}</p>
Can someone please help me out?