lundi 19 juin 2017

How can I built a url with a named route?

Im trying to generate a url link using a named route. For example, i have http://myapp.com/{token} . But, I had been using a lot of function with route but the result that I have is http://myapp.com?token instead of http://myapp.com/token

What can I do?

The only way to generate the good url is using the function url without the name of url. For example: url( '/reset', [$token]) . But in this case, I am not using the name of the route where that is what I would like to use.

Real problem: I have a route like this:

// Password reset routes...
Route::get('reset/{token}', [
    'as' => 'password.reset',
    'uses' => 'Auth\PasswordController@getReset'
]);

A blade template:

<a href="">Click here to reset your password</a>
<br>
<a href="">Click here to reset your password</a>
<br>
{!! link_to_route('password.reset', 'Click here to reset your password', $token) !!}
<br>
<a href="">Click here to reset your password</a>

The result is:

<a href="http://ift.tt/2rNxEL8">Click here to reset your password</a>
<br>
<a href="http://ift.tt/2silEVL">Click here to reset your password</a>
<br>
<a href="http://ift.tt/2silEVL">Click here to reset your password</a>
<br>
<a href="http://ift.tt/2silEVL">Click here to reset your password</a>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire