//go to 18 min mark in link
//html:
<div class="btnContainer">
<form method="POST" action='/user/{{ $user->id }}'>
@csrf
@method('DELETE')
<button type="submit" class="submitbtn" name="deleteUser">Delete user</button>
</form>
</div>
//Route:
Route::delete('/user/{user}', function($id){
$user = User::findOrFail($id);
$user->delete();
return redirect('/users');
});
public function destroy(Post $post)
{
Gate::authorize('delete',$post);
Storage::delete("public/cover/".$post->cover);
$post->delete();
return redirect()->route('index')->with('status','Post Deleted');
}