Home > Backend Development > PHP Tutorial > How to set the admin route in laravel5.2 so that only administrators can log in?

How to set the admin route in laravel5.2 so that only administrators can log in?

WBOY
Release: 2016-07-06 13:52:51
Original
854 people have browsed it

As mentioned, how to make the admin route open only to the administrator account? Ordinary logged-in users cannot access the backend. Thanks.

Reply content:

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>
Copy after login

});

The admin.login middleware is defined by myself and then added to Kernel.php
How to set the admin route in laravel5.2 so that only administrators can log in?

How to set the admin route in laravel5.2 so that only administrators can log in?

It can be achieved by adding middleware, subject to limitations.

In routing, adding middleware can achieve

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template