Url helper with GET parameter in laravel -
i want create url format :
domain.com/list?sortby=number&sortdir=desc
in view (blade). i'm using approach don't prefered :
{{ url("list")."?sortby=".$sortby."&sortdir=".$sortdir }}
because using
{{ url("list", $parameters = array('sortby' => $sortby, 'sortdir' => $sortdir) }}
didn't produce hoped. there better way?
have tried url::route
method.
example route:
route::get('/list', array('as' => 'list.index', 'uses' => 'listcontroller@getindex'));
retrieve url specific route query string:
url::route('list.index', array( 'sortby' => $sortby, 'sortdir' => $sortdir ));
if using closure on route:
route::get('/list', array('as' => 'list.index', function() { return url::route('account-home', array( 'sortby' => 1, 'sortdir' => 2 )); }));
Comments
Post a Comment