Laravel 重定向到特定 URL
Laravel Redirect to an specific URL
我正在使用 laravel 5.8,我想要一个中间件或某种技术来阻止非特权用户访问除特定 URL.
之外的任何其他 URL
当非特权用户访问 url 时,he/she 应立即重定向到特定的允许页面。
Route::get('/home', 'HomeController@index')->name('home')->middleware(['verified',...]);
在你的路由文件中,你应该 运行 只有经过身份验证的用户才能通过 auth
中间件访问的所有路由。
Route::group(['middleware' => ['auth']], function() {
Route::get('/home', 'HomeController@index')->name('home');
// more routes
});
要指定应将用户重定向到的位置,您可以在 app/Http/Middlware/Authentication.php
打开中间件并检查方法
protected function redirectTo($request)
我正在使用 laravel 5.8,我想要一个中间件或某种技术来阻止非特权用户访问除特定 URL.
之外的任何其他 URL当非特权用户访问 url 时,he/she 应立即重定向到特定的允许页面。
Route::get('/home', 'HomeController@index')->name('home')->middleware(['verified',...]);
在你的路由文件中,你应该 运行 只有经过身份验证的用户才能通过 auth
中间件访问的所有路由。
Route::group(['middleware' => ['auth']], function() {
Route::get('/home', 'HomeController@index')->name('home');
// more routes
});
要指定应将用户重定向到的位置,您可以在 app/Http/Middlware/Authentication.php
打开中间件并检查方法
protected function redirectTo($request)