Laravel5 student score management system-03-login and logout Function-permission-Middleware

Source: Internet
Author: User
Laravel5 student score management system-03-login and logout Function-permission-Middleware

In this section, we complete the login and logout Function, set middleware in the routing, and filter some illegal requests.Middleware,User authorizationPlease refer to the official documentation. if you are a newbie, we strongly recommend that you first read the documentation and start the following work.

First look at the route for logging out of routes. php:

################# Login and logout ############## Route :: get ('login', ['middleware '=> 'guest', 'as' => 'login', 'usersinfo '=> 'logincontroller @ LoginGet']); Route:: post ('login', ['middleware '=> 'guest', 'usersinfo '=> 'logincontroller @ loginpost']); Route: get ('logo ', ['middleware '=> 'auth', 'as' => 'logo', 'usersinfo' => 'logincontroller @ logo']);


Guest only allows visitors (without logon) to access the get route login and post route login. if they have logged on, they will jump to the corresponding page and pay attention to the keyword response. There are two types of login users: Students and administrators. when they log on, they will definitely make different responses to access these two routes. That is, students go to the student homepage, administrators, and administrators homepage. now let's take a look at RedirectIfAuthenticated. php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.