mercredi 6 mai 2020

laravel 7 destroy route not working , it redirect me to the show route

when i try to delete a user it redirect me to the user profile ( show method) its not showing any errors , but it behaves like i asked for the show method

the route

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

the link to the destroy method

 <a href="">delete</>

the destroy method in the controller

 public function destroy($id)
        {
            $user = User::find($id);
            $user->delete();
            return redirect('/users')->with('success','Utilisateur est supprimé');
        }

i tried excluding the destroy method from the ressource routes and creating it seperatly but it dont work



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire