//Роуты:// PHP: Route::get('/users/main',[UserController::class,'main'])->name('user.main'); Route::get('/users/index',[UserController::class,'index'])->name('user.index'); Route::get('/users/create',[UserController::class,'create'])->name('user.create'); Route::get('/users/{user}',[UserController::class,'show'])->name('user.show'); Route::post('/users',[UserController::class,'store'])->name('user.store'); Route::get('/users/{user}/edit',[UserController::class,'edit'])->name('user.edit'); Route::patch('/users/{user}',[UserController::class,'update'])->name('user.update'); Route::delete('/users/{user}',[UserController::class,'destroy'])->name('user.destroy'); //Контроллер:// PHP: public function destroy(User $user){ $user->delete(); return redirect()->route('user.index'); } //Представление:// PHP: <x-layout> <div class="container"> <table class="table"> <thead> <tr> <th scope="col">id</th> <th scope="col">Имя</th> <th scope="col">Фамилия</th> </tr> <tr> <th scope="col">{{$user->id}}</th> <th scope="col">{{$user->name}}</th> <th scope="col">{{$user->surname}}</th> </tr> </table> <div> <a href="{{ route('user.edit',$user)}}" class="btn btn-secondary">Обновить</a> </div> <div> <form action="{{ route('user.destroy',$user)}}" method="POST"> @csrf @method('destroy') <input type="submit" value="удалить" class="btn btn-warning"> </form> </div> <a href="{{ route('user.index')}}">назад</a> </div> </div> </x-layout>