Reputation: 1478
I would like to create an url as shown below
/domain/url=cloud_hosting&name=cloud_hosting
this is the href url that I use in my blade
<a href="{{ url('domain', ['url' => Request::segment(2), 'name' => $page_name]) }}">continue</a>
but that href url is generating different route
/domain/cloud_hosting/cloud_hosting
I have tried this one:
<a href="{{ route('domain') }}?url={{ Request::segment(2) }}&name={{ $page_name }}">Continue</a>
and that's working fine. But is there any other way which is nice and beautifull? Thank you
Upvotes: 0
Views: 749
Reputation: 1138
You can also use the query method:
url('domain', Arr::query(['url' => request()->segment(2), 'name' => $page_name]))
// /domain/url=cloud_hosting&name=cloud_hosting
Upvotes: 1
Reputation: 1045
you can do something like below. simply make a get request as in Web.php
Route::get('domain')
and can use it like below and can pass multiple query strings:
<a href="{{ url('domain?url='.Request::segment(2).'&name='.$page_name) }}">continue</a>
Upvotes: 1