This article mainly shares with you laravel's implementation of front-end and back-end user verification separation. I hope it can help everyone.
While using laravel brings us convenience, we also encounter reasons why we don’t understand what he does. Take the auth verification that comes with laravel as an example. You can rewrite it according to your own wishes, but is it still easy to use? For example, the default verification is email or user_name and password verification together. What if I need multiple login methods to exist at the same time? For example:
When I register, I need to support the following three login methods at the same time. How should I rewrite it? Does it feel a little difficult?
* @desc 1. interface_type=1, mobile phone number + SMS login;
* @desc 2. interface_type=2, mobile phone number + password to log in;
* @desc 3. interface_type=3, email + password login;
This issue will not be discussed here today. What we are going to talk about today is the auth permissions for both the backend and the frontend at the same time. That is, a website has both front-end users and back-end users, both of whom have login requirements, but the main page you enter is one for the front-end and the other is the back-end.
Let me talk directly about my approach:
After downloading laravel from composer or laravel, the steps required:
+ cp .env.example .env
+ php artisan key:generate
+ composer install
We need to use the login verification at the front desk, so we also need:
php artisan make:auth
The above is the detailed content of laravel implements separation of front and back user verification. For more information, please follow other related articles on the PHP Chinese website!