How to generate route with query string parameter in Laravel 5?

By Hardik Savani | April 7, 2016 | | 1697 Viewer | Category : Laravel


Share this post:

Whenever you require to add query string parameter in link url, i mean in route then you generate link with query string parameter using Laravel 5 URL facade. most of new developer doing this way:

<a href="{{ URL::route('home') }}.'?id=1&test_id=2'">Test</a>

But you should do it that this way, bellow example you can see how it done.

<a href="{{ URL::route('home',['id'=>'2','test_id'=>'3']) }}">Test</a>