You need to send a DELETE
request instead of a GET
request. You can't do that with a link, so you have to use an AJAX request or a form.
Here is the generic form method:
<form action="{{ URL::route('user.destroy', $members['id'][$i]) }}" method="POST">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button>Delete User</button>
</form>
If you're using Laravel 5.1 or later then you can use Laravel's built-in helpers to shorten your code:
<form action="{{ route('user.destroy', $members['id'][$i]) }}" method="POST">
{{ method_field('DELETE') }}
{{ csrf_field() }}
<button>Delete User</button>
</form>
If you're using Laravel 5.6 or later then you can use the new Blade directives to shorten your code even further:
<form action="{{ route('user.destroy', $members['id'][$i]) }}" method="POST">
@method('DELETE')
@csrf
<button>Delete User</button>
</form>
You can read more about method spoofing in Laravel here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…