在web.php路由文件中,我已经定义了路由组中的所有路由,但是其中一些不起作用,并显示空白页面,但是在没有前缀的路由组之外定义时显示该页面。
Route::group(['middleware' => 'auth', 'prefix' => 'admin'], function () {
Route::get('/home', 'HomeController@index')->name('home');
Route::resource('/category', 'CategoryController')->except(['destroy']);
Route::get('/category/delete/{category}', 'CategoryController@destroy')->name('category.delete');
Route::resource('/post', 'PostController')->except(['destroy']);
Route::get('/post/delete/{post}', 'PostController@destroy')->name('post.delete');
Route::get('/post/{post}/restore', 'PostController@restore')->name('post.restore');
Route::get('/post/{post}/forceDelete', 'PostController@forceDelete')->name('post.forceDelete');
Route::resource('/tag', 'TagController')->except(['destroy']);
Route::get('/tag/{tag}/delete', 'TagController@destroy')->name('tag.destroy');
Route::resource('user', 'UserController')->except(['destroy']);
Route::get('/user/{user}/delete', 'UserController@destroy')->name('user.delete');
Route::get('user/{user}/admin', 'UserController@makeAdmin')->name('user.admin')->middleware('admin');
Route::get('/user/{user}/makeUser', 'UserController@makeUser')->name('user.user');
Route::get('user/profile', 'ProfileController@index')->name('user.profile');
Route::post('user/profile/update', 'ProfileController@update')->name('user.profile.update');
});
答案 0 :(得分:0)
您的路由相互冲突,使用Route::resource
生成的路由与您自己定义的路由enter code here
引起冲突。
这里可能有问题
Route::get('/user/{user}/delete', 'UserController@destroy')->name('user.delete');
Route::get('user/profile', 'ProfileController@index')->name('user.profile');
'profile'
可能作为参数用户被传递,并抛出空白页。