I'm trying to paginate data that's returned from a model.
But keep getting an error :
Call to undefined method App\Shortlist::links()
Its on my Shortlist model and the code I'm using the paginate is (Controller)...
public function shortlist()
{
$view_data = array
(
'shortlist' => Shortlist::where('user_id', $this->user_id)->with('property')->orderBy('created_at', 'desc')->paginate(4)
);
$view = 'frontend.'.themeOptions().'.account.shortlist';
// Change View Per Template...
if(view()->exists($view))
{
// Shared View in the Templates...
return view($view, $view_data);
}
else
{
// Load Shared View...
return view('frontend.shared.account.shortlist', $view_data);
}
}
Then in my view, I'm using :
{{ $shortlist->links() }}
But keep getting that error, any help as to why?
Thanks