I'm passing a collection of posts to my view and I'm trying to use pagination, but I have this error:
Method Illuminate\Database\Eloquent\Collection::links does not exist
CONTROLLER
public function index() {
$posts = Post::where('visible', 1)
->where('expire_date', '>', $current)
->where('delete', 0)
->get();
return view('search', compact('posts'));
}
VIEW
<div class="pagination-bar text-center">
{{ $posts->links() }}
</div>