Routes and Href in the sidebar menu

1

I have the following problem, I get a question mark "?" instead of "/" in my link of the "security (security)" option in the sidebar or url menu

URL

Sidebar menu

Routes

Controller

Router list

How can I solve that?

Thank you!

    
asked by Felipe 19.03.2018 в 18:15
source

1 answer

1

The problem is that you have two routes with the same name , so laravel search the last one and omit the rest, then as your last route defined with the name security is: Route::put('/panel/security','UserController@securityUpdate')->name('segurity') , is to which it is redirected and not to the first as you wish.

The solution is simple, change to one of these the name or both, which is what I recommend.

On your web.php

Route::get('/panel/security/{id}','UserController@securityEdit')->name('segurity.edit')
Route::put('/panel/security','UserController@securityUpdate')->name('segurity.update')

and your view for the edition:

<a href='{{route('security.edit',auth()->user()->id)}}'>editar</a>

or for the update:

<form role="form" action="{{route(security.update)}}" method="put">
....mucho codigo
</form>
    
answered by 19.03.2018 / 19:08
source