显示和编辑资源控制器的路由得到404未找到错误

时间:2018-04-07 19:11:11

标签: php laravel laravel-5.5

我有一个master.php文件包含may laravel项目的一些路线。像这样:

Route::group([
    'prefix' => 'master',
    'as'     => 'master.'
], function () {
    Route::get('/login', 'MasterController@showLoginForm');
    Route::post('/login', 'MasterController@masterDoLogin');

    Route::group([
        'middleware' => ['auth:master']
    ], function () {
        Route::get('dashboard', ['as' => 'admin_dashboard', 'uses' => 'DashboardController@index']);

        Route::group(['prefix' => 'websites', 'as' => 'websites.'], function () {
            Route::get('websitesDatatable', ['as' => 'websitesDatatable', 'uses' => 'WebsiteController@websitesDatatable']);
        });
        Route::resource('websites', 'WebsiteController');
    });
});

在以下php artisan route:list处运行的路线后,显示一切正确:

  | GET|HEAD  | master/dashboard                                 | master.admin_dashboard                    | App\Http\Controllers\DashboardController@index                              | web,auth:master                                      |
|                           | POST      | master/login                                     | master.                                   | App\Http\Controllers\MasterController@masterDoLogin                         | web                                                  |
|                           | GET|HEAD  | master/login                                     | master.                                   | App\Http\Controllers\MasterController@showLoginForm                         | web                                                  |
|                           | POST      | master/websites                                  | master.websites.store                     | App\Http\Controllers\WebsiteController@store                                | web,auth:master                                      |
|                           | GET|HEAD  | master/websites                                  | master.websites.index                     | App\Http\Controllers\WebsiteController@index                                | web,auth:master                                      |
|                           | GET|HEAD  | master/websites/create                           | master.websites.create                    | App\Http\Controllers\WebsiteController@create                               | web,auth:master                                      |
|                           | GET|HEAD  | master/websites/websitesDatatable                | master.websites.websitesDatatable         | App\Http\Controllers\WebsiteController@websitesDatatable                    | web,auth:master                                      |
|                           | DELETE    | master/websites/{website}                        | master.websites.destroy                   | App\Http\Controllers\WebsiteController@destroy                              | web,auth:master                                      |
|                           | PUT|PATCH | master/websites/{website}                        | master.websites.update                    | App\Http\Controllers\WebsiteController@update                               | web,auth:master                                      |
|                           | GET|HEAD  | master/websites/{website}                        | master.websites.show                      | App\Http\Controllers\WebsiteController@show                                 | web,auth:master                                      |
|                           | GET|HEAD  | master/websites/{website}/edit                   | master.websites.edit                      | App\Http\Controllers\WebsiteController@edit                                 | web,auth:master    

master/websitesmaster/websites/createmaster/websites/websitesDatatable等路线运行正常。

但其他路线如master/websites/1master/websites/1/edit无法识别,并始终返回 404 not found 错误。 我不知道是什么问题?

如果有人知道,请帮助我。

0 个答案:

没有答案