I made a user management system with soft deletion and force deletion options. However, I'm having trouble getting the force deletion option to work.
The route:
Route::post('users/{user}/delete', 'UserController@forcedelete');
The relevant controller code:
public function forcedelete(User $user)
{
$user->forceDelete();
return redirect('users/trash');
}
The view code:
<a href="{{ url('users/'.$user->id.'/delete') }}" onclick="event.preventDefault();document.getElementById('delete').submit();">
<i class="fa fa-trash-o btn btn-danger btn-xs"></i> </a>
<form id="delete" action="{{ url('users/'.$user->id.'/delete') }}" method="POST" style="display: none;"> {{ csrf_field() }} {{ method_field('DELETE') }}
</form>
The error that I'm getting is
MethodNotAllowedHttpException in RouteCollection.php line 233: