LARAVEL5 Student Achievement Management System -03-Login Logout Function-permissions-middleware

Source: Internet
Author: User

In this section, we complete the login logout function, set up middleware in the route, filter some illegal requests, about middleware , user authorization Please refer to the official documentation, if it is novice, it is highly recommended to first look at the document and then start the following work.

First look at the routes.php log-out route:

     ################# Login Logout function ############# #Route:: Get (' login ', [    ' middleware ' = ' guest ', ' as ' = ' login ', ' Usersinfo ' = ' logincontroller@loginget '); Route::p ost (' Login ', [    ' middleware ' + ' guest ', ' usersinfo ' = ' logincontroller@loginpost ']); Route::get (' logout ', [    ' middleware ' = ' auth ', ' as ' = ' logout ', ' usersinfo ' = ' logincontroller@logout ']) ;

Guest only allows visitors (without landing) access to get routing login and post routing login, if already logged in, will jump to the corresponding page, note the keyword response. There are two types of login users, students, and administrators who, when they log in, want to access these two routes, will definitely respond differently. That is, students, jump to student homepage, admin, jump to admin homepage. Now look at redirectifauthenticated.php.

  • Related Article

    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: 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.