Home >Backend Development >PHP Tutorial >How to set the admin route in laravel5.2 so that only administrators can log in?
As mentioned, how to make the admin route open only to the administrator account? Ordinary logged-in users cannot access the backend. Thanks.
As mentioned, how to make the admin route open only to the administrator account? Ordinary logged-in users cannot access the backend. Thanks.
//Background routing
Route::group(['prefix' => 'admin', 'middleware' => 'admin.login'], function () {
<code>Route::get('index', function () { echo "admin/index"; }); //后台文章管理界面 Route::resource('article', 'ArticleController');</code>
});
The admin.login middleware is defined by myself and then added to Kernel.php
It can be achieved by adding middleware, subject to limitations.
In routing, adding middleware can achieve