我在Laravel 5.1中有一个分组路线,以便发布'声明'在' admin'。当我访问http://app.local/announcement时,一切正常,我得到了#hello'。但是,当我访问http://app.local/admin/announcement时,我什么都没得到。没有错误 - 只是一个空白的屏幕。
任何想法??
routes.php文件:
//Admin controller.
Route::resource('admin', 'AdminController');
//Route for admin/announcement
Route::group(['prefix' => 'admin'], function () {
Route::resource('announcement', 'AnnouncementController');
});
//Test route.
Route::resource('announcement', 'AnnouncementController');
我的公告控制人:
class AnnouncementController extends Controller
{
public function index()
{
return dd('hello');
}
}
PHP artisan route:list(相关部分):
| | GET|HEAD | admin/announcement | admin.announcement.index | App\Http\Controllers\AnnouncementController@index | |
| | POST | admin/announcement | admin.announcement.store | App\Http\Controllers\AnnouncementController@store | |
| | GET|HEAD | admin/announcement/create | admin.announcement.create | App\Http\Controllers\AnnouncementController@create | |
| | PATCH | admin/announcement/{announcement} | | App\Http\Controllers\AnnouncementController@update | |
| | DELETE | admin/announcement/{announcement} | admin.announcement.destroy | App\Http\Controllers\AnnouncementController@destroy | |
| | PUT | admin/announcement/{announcement} | admin.announcement.update | App\Http\Controllers\AnnouncementController@update | |
| | GET|HEAD | admin/announcement/{announcement} | admin.announcement.show | App\Http\Controllers\AnnouncementController@show | |
| | GET|HEAD | admin/announcement/{announcement}/edit | admin.announcement.edit | App\Http\Controllers\AnnouncementController@edit | |
| | GET|HEAD | announcement | announcement.index | App\Http\Controllers\AnnouncementController@index | |
| | POST | announcement | announcement.store | App\Http\Controllers\AnnouncementController@store | |
| | GET|HEAD | announcement/create | announcement.create | App\Http\Controllers\AnnouncementController@create | |
| | PATCH | announcement/{announcement} | | App\Http\Controllers\AnnouncementController@update | |
| | DELETE | announcement/{announcement} | announcement.destroy | App\Http\Controllers\AnnouncementController@destroy | |
| | GET|HEAD | announcement/{announcement} | announcement.show | App\Http\Controllers\AnnouncementController@show | |
| | PUT | announcement/{announcement} | announcement.update | App\Http\Controllers\AnnouncementController@update | |
| | GET|HEAD | announcement/{announcement}/edit | announcement.edit | App\Http\Controllers\AnnouncementController@edit | |
非常感谢, 史蒂夫