Easily implement login authentication function with Laravel

[Prerequisites] The Lamp environment has been installed normally. Node.js is installed. The database is set up. Can handle artisan command to some extent.

If you haven't installed Node.js, please refer to @ seiba's article. [Citation link] https://qiita.com/seibe/items/36cef7df85fe2cefa3ea

1, check the version

First, check the version of Laravel, enter the following command.

php artisan --version

Check if the version of Laravel is 6 series or 7 series.

2. Install Laravel/ui.

For 6 series, install with the following command

composer require laravel/ui:^1.0 --dev

For 7 series, install with the following command

composer require laravel/ui:^2.4

3, implement the authentication function

Implement the login function by entering the following command for both 6 and 7 systems.

php artisan ui vue --auth

At this point, the login function is not complete, at this point the REGISTER scene Looking at it ……… The front end part is not implemented. authtest.png

4, implement the front end part ~ completed

install npm

npm install

Build npm

npm run dev

Don't forget to use the migration command to create a table to store login information at the end.

php artisan migration

done Start Laravel and click Register on the far right authtest1.png Then, the front end part that was not implemented earlier is implemented. authtest2.png Actually register authtest3.png

If you actually log in successfully, you can move to the page after logging in. authtest4.png

Extra: How the data is stored

If you look at the table where the passwords are actually stored, you can see that the passwords are encrypted and stored, which can be easily implemented and is a fairly advanced authentication function.


|  1 |Laravel user| [email protected] | NULL |
 $2y$10$KPPRJJH0fOYl1JocEdQscu3NNl5BrJU.MpEu4AY1I2ye6F5z18Zsq | NULL           | 2021-01-13 12:40:02 | 2021-01-13 12:40:02 |
+----+--------------------+-------------------+-------------------+--------------------------------------------------------------+----------------+---------------------+---------------------+

Reference site [Official version] Laravel official tutorial Japanese translation https://readouble.com/laravel/7.x/ja/authentication.html

Recommended Posts

Easily implement login authentication function with Laravel
Easily implement subcommands with python click
[python3] Implement debug log output function easily with logging and Click
Ssh login with public key authentication quickly
Implement large size stamp function with discordBOT
Easily implement ItemView incremental search with PySide
Twitter posting client made with Flask with simple login function
Implement FReLU with tf.keras
Creating an authentication function
Easily beep with python
I was able to implement web app authentication with flask-login
Easily create authentication, user management, and multilingual systems with Flask-AppBuilder