I have been working with Laravel 5.x for a few months now and I was just wondering on what is the difference between using links and render when using pagination. I did a few research and people are using the two the same way.
Given I have a array variable that has been returned from my controller and I would cut the pagination into 5 items per view.
public function index()
{
$variable = Jobs::getJob()->paginate(5);
return view('index', compact('variable'));
}
on my index.blade.php I will display the items that I have taken
@foreach($variable as $key => $values)
//code here
@endforeach
{{ $variable->render() }}
//same result as
{{ $variable->links() }}
My question now is what are the difference between the two and when should one be use instead of the other?
Thanks
The links()
(source) method is simply an alias for the render()
(source) method. It seems it was introduced in Laravel 5.2.
So basically, it doesn't make a difference which you use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With