I have written the code below in my controller to delete a comment :
public function destroy($ID)
{
$post = Comment::find($ID);
$post->delete();
return redirect()->back();
}
And this is my Route :
Route::delete('/deleteComment/{ID}', 'CommentController@destroy');
And this is my form :
<form action="{{ url('/deleteComment/'.$comment->ID) }}" method="post">
{{ csrf_field() }}
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="btn btn-sm btn-danger">حذف کردن</button>
</form>
But When I click the button, It doesn't delete anything ... I appreciate any response ...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire