Build Laravel 10 Multi Vendor ECommerce project: #7 Admin Auth Login

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we are going to make admin login process functionality I highly recommend to watch our multi-guards authentication video tutorial for more about multi-guards in laravel the video link is in this video description below go to terminal and create admin controller as you can see admin controller file has been created open admin Roots file and delete this testing route import admin controller on this file let's create root prefix group for admin inside this group add other two middleware groups first root group has guest middleware where all Roots inside this will be accessible only when admin not authenticated where the second root group has auth middleware and all Roots inside this will be accessible only when admin authenticated create view route for admin login page create also view route for admin home dashboard page create admin login and home views blade files foreign you see we can access admin login page let's extends auth layout to this admin page as you can see we have now beautiful admin login page let's add login form to this page foreign before continue we are going to create default admin we need to insert at least one admin record inside this admins table go to terminal and create admin cder file as you can see admin cder file has been created add the following inside this run function open this database Cedar file and call additional admin seater then run Cedar by using this command as you can see we have now admin record into admins table let's continue and then update for input fields foreign for admin login Handler let's use this root name to the admin login form action attribute don't forget to add csrf token to this form add login Handler method inside admin controller class before continue we have to make some changes on authenticate.php and redirect if authenticated.php middleware files for authenticate.php file inside this redirect to Method we check if someone tried to access admin root without authenticated and then redirect this user to the admin login page with fail message for redirect if authenticated.php file we redirect admin to the admin home page if already authenticated back to admin controller don't forget to import auth facade here first validate the form here we check if the entered login ID type is email or username if the login ID type is an email login ID must be required be an email format and exists in admins table on email column password must be required with minimum of five characters and maximum of 45 characters everything if the login ID type is in username login ID must be required and exists in admins table on username column password must be required with minimum of five characters and maximum of 45 characters let's see if validation works or not as you can see validation works perfectly let's continue if validation success let's check entered admin username or email and password as you can see we specify admin guard here so if entered username or email and password matches to the values stored into admins table redirect this user to the admin home page otherwise redirect this user to the admin login page with fail message Let's test if we entered no existing username we get this error but if we entered exist's username or email no error displayed if we entered wrong password we get this error let's try real credentials good after entered correct credentials we redirected to the admin home page which is good if we try to access login page we redirect it back to home page because we already logged in let's apply our admin page layout here foreign as you can see we have good admin page layout let's create logout functionality okay add new post root for admin logout we are going to use this root name to admin logout anchor tag add logout Handler method inside admin controller class Let's test as you can see logout link works perfectly if we try to access home page without logged in we redirected back with this message see you in next video
Info
Channel: Irebe Library
Views: 12,811
Rating: undefined out of 5
Keywords: irebe library, mberecall, laravel ecommerce project, laravel ecommerce, laravel e commerce full project, laravel multi seller ecommerce, laravel multi vendor ecommerce, laravel multi vendor ecommerce tutorial, laravel multi vendor, laravel admin authentication, laravel admin auth middleware, laravel 9 multi auth admin and user, laravel authentication, laravel authentication 9, laravel tutorial, laravel 10
Id: mRHV9oNA4Qg
Channel Id: undefined
Length: 21min 17sec (1277 seconds)
Published: Thu Jun 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.