似乎在添加
Route::controller('acme','Acme');
在名称间隔路由组内部不起作用,我必须将其从整个组中取出
检查下面的代码
// this code does not work, error message:
//
// --------------------
// ReflectionException
// Class Api\Controllers\V1\Api\Controllers\V1\Acme does not exist
// --------------------
//
// the error appears after adding Route::controller('acme', 'Acme'); inside the name spaced route group
Route::group(['prefix' => 'api','namespace' => 'Api\Controllers'], function()
{
Route::group(['prefix' => 'v1','namespace' => 'V1'], function()
{
Route::resource('acme', 'Acme', [ 'only' => ['index', 'show', 'store', 'update', 'destroy'] ]);
Route::controller('acme', 'Acme');
});
});
// this code is working fine after taking Route::controller('acme', 'Acme'); outside the name spaced route group
Route::group(['prefix' => 'api','namespace' => 'Api\Controllers'], function()
{
Route::group(['prefix' => 'v1','namespace' => 'V1'], function()
{
Route::resource('acme', 'Acme', [ 'only' => ['index', 'show', 'store', 'update', 'destroy'] ]);
});
});
Route::controller('acme', 'Api\Controllers\V1\Acme');
如果你更喜欢它,你可以在这里查看代码
这是一个错误还是我错过了一些东西?
答案 0 :(得分:0)
是的,这是一个错误。只是在这里转载确认。
并发布了此问题:https://github.com/laravel/framework/issues/3084
<强>更新强>
现在有效,泰勒刚杀了那个虫子。