Multiple role-based authentication in Laravel 7 2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
alright guys so let's dive in so the first thing we're gonna do we're going to install a lava and we're going to do that here so we're gonna install it on this current directory and why we wait for it to download so for those of us who don't know Islam this is the official website so this lava so you go to documentation then from documentation you choose the version you want so currently the most recent version is version 7 so this really hard middle of new futures no that weren't there before so all you just need to do is if you don't have composer you can make sure you done with composure composure eyes go with the dependency manager for PHP okay so if you want to dummy for Windows you can just use the download button here and they'll be there so once you have your composer installed already have it on my system so you can just copy this you know I'm installed it on your you can install it on your show your terminal so once you install this so install a blue top variable with this global variable you can be able to install novel from anywhere any system so once you're you're done with this okay which I've already done so the next thing we're gonna do is to is written a lot of her projects you just still love me blog you whatever you're building so for our project we actually use composer and we use this alright so that is that so let's go back to coding environment so it's so if you watch it has downloaded all this wow they're okay these are the different powers total downloaded all right so it's the did download processes T on all right so it don't process the students so in order to save our time I will skip diesel process seeing it's done yep yeah all right guys on the download is done so he's all the bunch of stuff so download it alright so basically does offer now so the next thing won't she do with no we need to understand what once appeared so for this particular system I'm gonna build authentication for three uses so these it's record wrote at i/o and is to basically just drought your flowchart to understand what you're doing so these are authentication system okay so in this authentication system I think I need to do something so in this authentication system like say okay Amiata finish system we have our login these are login system alright so in this login once a he's on logging so it depends on the type of user so he's being directed to different aspects in his system alright so his meanness so once you done logging he was a user it goes to the user dashboard it was not me he goes to the admissions board it is a manager custody manager dashboard okay so as you progress welcome back to dissolute chats you improve on it alright so one of its user you need for this tutorial is them because we need it for our database we needed for our server our server so this is Sam alright so we installed on the a vs2 PHP and the rest of them so just done with some time let's go so once you download it depending on your system bits you install let's go so for this particular project I'm going to I'm going to create a database I'm going to create a database for this so I'm going to create a database and the little bit of you know Chris a museum call it's lava moss multi he also does this all I need a bruschetta D it is a base I don't want any tables so right guys so that's all for now so let's go back to our application so the first thing we're gonna do is we're going to populate our migration table okay we're gonna copy the migration table so the key I used as a control P in mark is command P so we'll just search for migration table so we're gonna search for user traits user so dizzy migrations it will be looking for so we're going to populate this table so we're going to are things like we happening here we are in mail okay so let's add one which is very important we'll just okay so we are into here okay so this integers going to be the row right let's make it inaudible so so actually I didn't know the boat because most times he didn't feel table row he's not unknown you my little hover is so he's just advisable recommended I use that so what else Oh stickers ID so that's art so stairs all right the same alright so guys so we have done that down basically that is all for now so we are not adding any other information and okay so we are done with our migration table we just work on this we just did up how did some booths on table rows tourism that alright so next we're going to begin to migrate our table so I'm going to create a new terminal for that so you're saying PHP my grades sorry PHP artisan migrate okay oh sorry Sara Sara Sara brother so the first impresses you know EMV file in our environment file we're supposed to define our database you know the database we used was lover mati so for combo hey look at it lover motsi right so doesn't we been so hard so the reason why we had our error is because lover wasn't able to identify our database so if you have password you can put your possible here so I'm not using password currently somebody's using roots as my username and all of that so which is kind of like the basic settings for some database alright so that is that so successfully we've created a migration and that was great so the next thing we need to do is lava comes with out of the balls authentication so if you go to Louisville and search for authentication okay so if you search for authentication so now becomes an imputed education system that you can use for your app so we're going to use that [Music] you're gonna use that authentication system right now so you use the latest love a UI all right the first thing it needs to do is you need to install its via composer so composer require love slash your pie all right so you need to install the UI first so once the us done installing you cannot use this new lover components to install your authentication alright so the next we're going to do begin to install our authentication great so we have been able to use the labral default authentication doesn't create it for us so great so that's progress so the next thing we're going to do is we're going to test that are up so we can do PHP artisan sir and Lexi okay so we can check out up on this particular URL so you can either use these or okay so great so these are how we just created and so let's start right traits in this simple registration so let me say John week let's say John wick hot gin mill let's come so the password i'm using is just real crazy okay alright so let's see ok alright so click register see we are in ok via a nuns love dolls you can register in login so this is like a default login that authentication system DeLaughter provides so we're going to take our project up for me i'm going to scale it to tasks for today all right guys are alright guys so the next stage right now is to create a different controllers for our users so we're gonna do treat for the admin so it's going to be PHP artisan make controla admin controller right so now the press controller so the next controller you can make is stay the same so we're just going to do manager [Music] control okay so in total you can choice for users so we're gonna call it is user controller alright so there's a basically so we have create successfully created controllers so just little critters controllers are the same we're gonna quit the media where's so to say PHP artisan make me do well and the first media where you're making is body at me so the nest middleware we are making is for team manager okay so the last video where we are making this for you you user alright so we are done with that and let alright guys so the next thing we're going to register all our middleware so does go to channel so right here we're going to register all our ups okay so why are we going to register a lot so the first thing first we can you just come under here so say hardening okay hop HTTP slash middle of knitting mr. slash middleware slash had me in class right so let's so next one having to do we saw manager so I just come and save manager okay manager manager so the last guy I'm gonna paid for is easier and user alright guys so successfully registered all my middle okay so alright guys so the next movies we are going to create out of you we're going to create our ears and so [Music] alright guys so we're gonna create our views I'm just trying to collapse these folders alright so the view is on the resources view so we actually have three different uses so I'm just gonna create a first one for admin so every time I listen to the admin will be here so the next one of you know crazy is a manager so every time relating to the manager is going to behave so the last one I'm going to create is also okay his own uses uses alright so I'm not only gonna do much so inside the user just going to create index dot late dot PHP oh and also play don't PHP so the next one I'm gonna quit is still the same index dots Lee taught speech me and the last one for me stay index dot please don't PHP all right guys so what I'm just gonna do is I'm just gonna copy copy Adi HTML codes inside a home plate and I'm just going to pop it in to the different place so so I'm guessing you're logged in have mean a modular say you're looking manager then Jesus Lucy loading the user all right okay guys so that's all about the difficulties so the next thing we're going to do now is a again to go to our roots folders so we came to created our watch right now so we're and let's go down here so in our root folder the first thing won't do is uh you know first of all s comments days because won't be needs anymore alright so it's the first thing we're gonna do we're just gonna say roots right gets squash at me does the you're wonder visits so the next thing we can do is the name of our controller which is what admin the control of what needs a new controller so does this difficult go can you we just wanna see index mm not crazy is Victoria alright so you're going to give this routine name which is a hard min and begin to give it a middleware so the name of the middle world is it I mean other alright guys so we've been able to tradition so let's just duplicated and are movin so here we have a manager here we have so we turn this to manager because that's what we need to control oh and yes a manager and here you just say manager okay so likewise hey just say user yeah we say users okay sorry supposed to be smarter all right user name is alright guys so basically this just its body roots so we are done with our roots only a little bit cup so what do we do we just get the URL is a URL for the page this is the controller for this particular URL the admin area this is the name that we are giving to our roots and this is the middleware for these roots all right guys alright so let's move on so the next thing we'll be achieving right away is a will be a detainee in the middle well okay so the different video was created so we are into edit them alright so let's start with the admin middleware so in this video well so the first thing first we're gonna do is inside this function we are going to put an if statement to check all right so we're gonna say if odds hearts check okay yo check what you can do is return so let's get into redirects Austin sign just conservator ex-boss part to the login page so what means is if you have not logged in and you try to assess any of those pages any of the admin or manager or user pages is going to automatically take you about the login page so you must work logging so the other one we're gonna do is you're gonna say if now the user is looking which is odds so let's start with the user okay the Giza is nothing in his room so we can just give it a priority so for me I've been listening to our row row one yeah so it means in to everyone so if it's row one selecting Row 1 is equal to odd alright so Row 1 is equal to at me alright so if it is equal to Rho 1 then thing is going to do there's going to take us to is going to take us to the admin page so that's what has been a juice or return the current request all right so let's duplicate this so if it's root 2 root 2 is root soui the manager roots who is manager ok wrote to his manager and so if it's so if the user is half the role of a manager and is trying to assess the admin dashboard this was given to his Ginsu redirects this particular user okay it's going to redirect this particular user to just going to redirect is possible all right so also saying if the user is manager let's say when user logged in his rule is the rule of a manager and now the user is trying to go on assess the admin dashboard okay his systems automatically with Tony's use of path to the manager transport the understand so that's why November in this place we did name of routes right so we gave it at me manager unusual so this way is coming to play now so you're just going to give any material so it's going to return back towards manager alright so that is that then route this would show okay so we just gonna stick to placate this for the very last time so if they use them these are history it means that it uses what is it just a regular user so if he's three okay he's going to return the user back to the user alright that's what we use here right so you're just gonna return this is about syriza so this is this for the I've been middle way okay so that's that for the admin module so the next thing we're gonna do is every code that is here alright just to save time every code that is a you just want to copy and take it to the manager me the way so in the manager middle way just a sweetie they're gonna place today so now we're just going to do some changes so what we're saying is when we sorry guys close all right so now just the way we did for the admin so right now so if the admin is loading and his trains have gone assess the dashboard of the manager says games are returning back to the admin so we're just gonna remove this and replace it he this so what happens is if the user does nothing his administrative honest this manager the manager does both she's going to return these are back to the admin so same for this one so but if the user is a manager okay the user will be able to assess the manager dashboard alright guys so we're almost done so so for the user me the way we stick to the same thing King sorry but so for the user me the way so we stick on to the same thing okay so so what is our media where you just going to do the same thing that we do how do we teach a while ago so we're just gonna replace this so if the user if is a user that logged in is gonna take these out soon he's a page then if it's a manager dice trying to assess a user dashboard he's going to return is the manager about city manager dashboard alright guys so this just we had the logic is alright so now we're done with the middleware so let me close all this stuff right here so the last phase of this tutorial is to edit the controllers the different controllers all right so now the controller which is the last part of this tutorial so the first one first we're gonna do is you know admin we do where if we notice we use this class here and we didn't enforce it so that would have given us an L so it doesn't go hard it's here so use odds okay a simple with that so we're gonna repeat this process for you creamy the ways so manager okay so the user alright so now you will next want to do is login all right go back to our draw dots are you we booked up to our drugs I you find out that the login okay the login is the one of direct suits you everywhere in the system based on your user role so we need to edit our login controller so we're just gonna come and say logging controller alright so this is the logic controller so inside the logging controller we're going to do some some stops here alright so so under this protector with director - so we're going to create a public function this function call it with terrorists redirect tool [Music] okay so the next thing we're gonna do we're gonna write is switch statements and what we are just checking in in this usage we're just saying if the user is logged in its user if the user is logged in so here's our case one so the first case we check in is the admin ok so we are returning [Music] okay so we are saying that if they use our ravu okay we say that every user role is in line with this it is always hard when should you take his at soon at me all right tell us if case soon so much trekking in this case knock history sir okay if the user is what manager so this so he puts personal garden is a manager issue redirects the user to - all right so there's something we didn't do here so we did with some so that would have given us an error so you're just gonna say return this is redirects so all right so return this all right so the next one we're gonna do is just very times we've done this way director all right so brick so the next one we're gonna do for is the easy easy so you know how to save quality time so case three all right so guys are so now the last one the last but not the least is T so if everything fails all right so if the everything fails it should be Tony's about to be logging so we're just gonna say this [Music] redirect soon so we direct the user to login with our user to log in and yes return alright guys so basically this is this is it okay so this is the modification and that is that so the very last part of this amazing tutorial eats different controllers so we first are we really gonna do is the admin controller so add me that's it so first thing we're just gonna do just gonna say probably fits it public function public function index all right now this index we create a remember this index yeah you said I've been controller index so this is the index is the function crazy now alright so so next we gonna do we're just gonna be done view okay so view we get a return we created a folder called that mean no index all right so does the view retraining very simple an adding much all right so good you manage a controller so just changes to manager all right so we go to user controller we just changes to users all right guys yeah does it so let's test it pops all right let's go all right guys so let's test our vacation mouth so logging right so okay so we are logged in but not in issuing her oh so I know where that error is so you know in our controller we didn't know it's on give use really created them but we do recon them all right okay so we go back to wherever we read all right so you see you're logged in at me okay let me see if we type to do manager it's homework we try to do user different work so going to go through log out see if we go to manager so this monitor say stepheson add me tell me to redirect back to manager user to redirected back to manager alright so the test user so for the eros difficult our database so these are the different rules one two three so so basically guys Reza alright thank you for joining my class okay he's basically my first class and you know as time goes on things it begins to go much better so if you have any requests for any videos or you need to survey and like tulane please just shoot me a mail all right and I'll get back to you thank you frame see you later
Info
Channel: Enlighture Academy
Views: 18,690
Rating: undefined out of 5
Keywords: Multiple role-based authentication in Laravel 7, Laravel 7 crud tutorial, Laravel 7 crud tutorial in hindi, Laravel 7 tutorial, Laravel 7 new features, Laravel 7 authentication, laravel from scratch, laravel series, laravel tutorial, laravel project, php laravel php, php framework, Laravel 7 multi auth, Laravel 7 auth, laravel for beginners, Laravel 7 authentication tutorial, factory, seeder, helpers, laravel-multi-auth, laravel-ui, bootstrap ui, php artisan
Id: 5v5vcXjqyec
Channel Id: undefined
Length: 40min 4sec (2404 seconds)
Published: Sat Mar 07 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.