dimanche 31 janvier 2016

Laravel deleting method

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 ...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1SRNQ9w
via IFTTT

Aucun commentaire:

Enregistrer un commentaire