0

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

8
  • is the domain root url? Commented Aug 8, 2020 at 13:49
  • 2
    route('domain', [ 'url' => Request::segment(2), 'name' => $page_name ]) might also work Commented Aug 8, 2020 at 13:51
  • @NaveedAli. Not, it's just normal route defined on web.php Route::match(['get', 'post'], 'domain', 'Customer\DomainConfigurationControllers@index'); Commented Aug 8, 2020 at 13:56
  • @apokryfos, that's not what I wanted because it will be generating /domain/cloud_hosting/cloud_hosting Commented Aug 8, 2020 at 13:56
  • do you want to add it as a query string? Commented Aug 8, 2020 at 14:08

2 Answers 2

1

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>
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.