CRUD Laravel 5 how to link to destroy of Resource Controller?

后端 未结 10 2207
迷失自我
迷失自我 2020-12-15 17:27

I have a link



        
10条回答
  •  渐次进展
    2020-12-15 18:02

    My, non-ajax version. I use it in dropdowns (bootstrap) in resource list (datatables as well). Very short and universal.

    Global jQuery method:

    $('.submit-previous-form').click(function (e) {
        e.preventDefault();
        $($(this)).prev('form').submit();
    });
    

    And then we can use everywhere something like this:

    {{ Form::open(['route' => ['user.destroy', $user], 'method' => 'delete']) }} {{ Form::close() }}
     Delete him
    

    Recommend: It's easy to integrate with confirms scripts for example swal.

提交回复
热议问题