lundi 3 juin 2019

Reuse user resource route for current user

I've created a resource route for users.

Route::resource('users', 'UsersController');

My controller handles the path /user/1/edit with in my users controller like so:

public function edit(User $user)
{
    $this->authorize('update', $user);
    ...

The template for this page is: resources/views/users/edit.blade.php.

How would I define a new route, /user/edit, which dynamically passes the current user and reuses the edit(User $user) method while also reusing the same view template?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire