Laravel achieve registered users, login

A mounting Laravel (using Laravel5.5)

Create a project by Composer

composer create-project --prefer-dist laravel/laravel step "5.5.*"

May be due to various reasons failed installation, switching source, more than a few times should be installed on it (Note the error message).

Second, the configuration

Here only shows the relevant configuration database:

 

 Third, run the migration (to ensure that there is a corresponding migration file, there will be general)

 

 Use all outstanding migrate migration command to run artisan

php artisan migrate

 

 

 

 In this way, the corresponding data sheet on the establishment of complete, if you need to modify the fields, modify the migration file, you can run the migration, there will not be modified.

Four, to form the corresponding route, view, controller

Use the command Laravel provided

php artisan make:auth

 

 Then visit our Web site: http: // your-site / login, you will see an interface similar to the following

 

 Yes, you do not have an account, you need to register, click on the map of the Register, spicy dead dog

 

 Fill in the appropriate information to complete the registration after submitting, then you can log in. (Of course, registration is completed automatically logged in, and jump to the next / home)

Click logout Log out, jump to the root of the site.

V. Application

In web applications, there are some pages that require the user after logging in, then how to do it? Plus middleware auth when creating routes.

Add Route test

 

 Then, visit http: // your-site / test is not normal visit, will jump to the login interface (what you did not jump ?? probably already logged in, right?).

So far, almost complete, bits for.

Behind other related operations will be updated. . . (Not to say, to cook)

Guess you like

Origin www.cnblogs.com/Super-Lee/p/11487847.html
Recommended