use DELETE method in route with Laravel 5.4

前端 未结 3 1308
眼角桃花
眼角桃花 2020-12-09 09:25

I\'m working on a Laravel (v 5.4) project and i did the CRUD to manage categories. Currently, i can create a new category and i would be able to delete.

I created th

3条回答
  •  鱼传尺愫
    2020-12-09 09:34

    Any method other than GET and POST requires you to specify the method type using a hidden form input. That's how laravel detects them. In your case you need to send the delete action using a form. Do this.

    
        @foreach ($categories as $category)
            
        @endforeach
        
    Name Action
    $category->name
    {{ method_field('delete') }}

提交回复
热议问题