douzi8112 2016-01-29 20:12
浏览 225

Laravel 5在destroy路径上缺少必需的参数

I recently upgraded from laravel 5.1 to 5.2 and now I'm getting an error of Missing required parameters for [Route: example.destroy] [URI: example/{args}].

The error occurs here: <form class="form-horizontal" action="<?php echo route('example.destroy'); ?>" method="post"> on the action attribute of the form.

Here's how the route was registered on the route.php

Route::resource('example', 'ExampleController');

When I was in 5.1, there was no error with this line. Just went I upgrade to 5.2, it now occurs.

The functionality of this is that it will allow user to delete multiple entries by checking the checkboxes that they wish to be deleted. Then upon submit, it will redirect to the destroy method on the controller.

  • 写回答

3条回答 默认 最新

  • dongpin3794 2016-01-30 07:02
    关注

    You can try the following

    <form class="form-horizontal" action="<?php echo       
    url('example'); ?>" method="post">
    
    Route::post('example', 'ExampleController@destroy');
    
    评论

报告相同问题?