I have a custom view and in some functions, I used paginate
and other functions I don't use paginate
. now how can I check if I used paginate
or not ?
@if($products->links())
{{$products->links()}}
@endif // not work
of course that I know I can use a variable as true false to will check it, But is there any native function to check it ?
This works perfectly. Check if $products
is an instance of Illuminate\Pagination\LengthAwarePaginator
then display the pagination links.
@if($products instanceof \Illuminate\Pagination\LengthAwarePaginator )
{{$products->links()}}
@endif