Laravel Tutorial 7 - Login, Registration and Logout with PHP Laravel 10

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to Xerox laravel tutorial in this video we are going to learn how to create login register and logout with PHP laravel 10. there is some steps we'll go through by step so I step First Step will just install the laravel with the composer and how to use the composer install the composer we already created a video regarding that and second I am going to the that particular folder and I'm opening that one with the visual studio code vs code second there is a second step is there there is a database configuration I am using the mySQL database MySQL directly you can install or you can install using through the jam so I am using through the jam so I have a jam uh install the jump I have a jam control panel there is a database my circle is running with the port 3306 import I am using here and I'm just creating one database login register log out and username password I didn't set any password till now username is root and didn't set any password for till now this is completed next I am just running the migration migrate command to migrants migrate all the tables uh in the migration and next I'm just creating the roots what are the pages we need I'm creating that I'm just calling the controller after that I'm just creating the roots login post login registration post registration and dashboard after login we will just go to the dashboard and there is a logout button where we'll just end the session is there method I am using for the posting the data from the form so I am using the post for Opera next create controller create controller is the command for that PHP Artisan Mac controller and there is a path I am giving and controller name so controller automatically created next I'm just creating the blades so what are the blades we need blade file do we need I am creating that I need the layout and then dashboard after login I will go through the dashboard layout it will create the layout and I've just explained extending the layout to login and registration page and finally I will run the laravel app and I'll just test so let me go through the coding for just go through one folder wherever you want to create the project so there is folder is there I'm creating I'm just going through the command line here and here I'll create the project so project command is composer create project refer this Parable slash laravel then login then registration and program I'm clicking the enter automatically it will start to call in the laravel wait for few minutes it will automatically install the all the laravel dependencies YouTuber packages suggestion were added to the dependencies use composer suggest if you want to solve the suggestion to see the detail creating and next automatically creating the Auto load files here we'll get that you also that I will Auto generate key so again remember the command composer create project verify this and laravel stress laravel login registration and log out I am given the name the login registration and log out let it install then second we'll go for the database configuration that will be configured with the dot EnV file and we are using the mySQL database so I will put the MySQL and DB host name output and whatever the database Port we are using I will insert that and login regist give the database name to the database name so I am giving the database name login register logout and root I didn't put the password so let me check with the service login to localhost and 0 and phpmyadmin automatic V8 is logged in so I didn't set the password for that here we don't have any login register and log out database is there so we'll create the database for login register and log out automatically it will will create through the command or second we directly you can go to the database and you can create the database so both the way it will work let it complete we'll go step by step you're about to complete it the application key set successfully the reliable installation is completed now go to the folder login registration and log out so I'm going to folder and let me I want to open the code into the visual studio code so code space dot printer will get the vs code so now you check all the folders and files are available or not this is the MBC format so check with that so there is inside the HTTP there is a controllers there is a model and inside the resource we will get the views so step by step will do second step what we are going to do Second Step database configuration so let me go to the dot EnV file as the database I am using the MySQL import number is this localhost same as that here I'll put the login registration log out same name I am giving that and one more thing I'm just changing the app name my app name is login [Music] registration and logout so now database configuration is done next as let me check with the laravel is running or not properly go to the terminal and right here I want to increase the font size okay so PHP artisan and migrate click on enter it will ask you the create the database because database is not exist here so I'm just putting yes so automatically to create the database and it will migrate the table so now let me check reload login registration and logout database created and adjust table is also created name email password this filter created so my database configuration is done now I have to create the roots so before creating the roots let me create the controller and there I will create the page and I'll create the roots so here inside the controller I'm just creating one folder path inside the auth I'll just create the controller here let me check run the flowerable and check running or not so PHP artisan serve is it running with the the sport yeah my laravel is running with the larva version 10.13.0 and PHP version is 8.2.4 now let me now we'll take one more controller and just I'm going to create the controller so controller creating control command is PHP artisan serve back back controller then controller name I'm putting auth as hot hot controller so click on enter automatically it will create controller so auth controller is created here look at this and would would no need we don't want any model because model is already defined the same model we'll use here voltage is already we have now inside the controller we'll just create we'll create the pages and we will call so here I am creating one function probably function X and here I'll just call the view page return view of let me create the page so page will be created inside the resources View and I'm creating one folder auth because authentication purpose I'm just creating the pages here I'll create a page login dot play template red file dot PHP and one more thing here I am doing I'm doing for with using the layout so I'll create the layout folder inside inside the view folder on the not auth folder so I'm creating here layout dot play dot PHP and one more file dashboard I'm just let me create dashboard dot play dot PHP let's go to create a layout is created login created let me create the registration Regis registration Dot late Dot PHP sorry okay rename it so all the files are created you know so let me report code into the layout dot PHP so here we'll just code like PML HTML5 in vestors the real graph dot in I have given the name I need the Buddhist of CSS for Designing press purpose go to subsidian go to subsidian copy put it there the booty subsidian is completed now I need the navigation tag foreign model we can use so we are using the bootstrap there is a JavaScript and this stuff is there with this name bar we need to the call the function here yield function and here I'll create the content let me call this page into the log on login so whenever you are calling the login always extend the layout extend layout then we need the section here already content and six let me check with the login page so login page is created here I am calling the login page so login page inside the folder or Dot Login so I call the login page we need to check with the uh web.php so web.php inside the roots web.php here I'll call the login page my page name is login and my controller name is auth controller get the name from here what controller the name is index and my name is also login which call the controller here otherwise it will give you the error to undefined the controller controller name path controller this part is completed now let me run with the login page slash login I think some CSS missing let me use the Sim CSS JavaScript okay finally I got that and uh there is a poster going to use that real function I got it graphs not even coming remove that one user that okay so my page is coming this is logout so in this page just assume that these are the main nodes okay these are the drop down menus there is a drop down menu also there is a sign in button and sign up and sign in I'll give the path for the both the button and I will read write the code for the hiding the assign in sign up here let me give the path URL same thing I'll do here I'll just you know sign up in front of sign up I'll use the registration there also I'll use the registration similarly I'll use here login and I'll just create the registration also web .php listen function name application I'll give the name also station now I'll create the function for the registration for registration then is also method is also created now login page is that similarly I'll do it registers so this pages are completed this is my login page yes registration page and the layout login page registration page okay this is changing login page and registration page now I'll just write the code for login and registration and we'll view the login and when we will view the registration so at the rate test and second log out log out here I'll try the log out so now I'll just create the function for logout last function is that dog out written redirect after logout I will just redirect to the my login page login page before return to the login page I'll just close the session station colon Plus and but logout automatically it will log out it will clear the session engage and it will return to the login page so now we have to create the registration page so registration page there will just insert all the data to the database test using the container Dot container then Pro class then call and eight Dot set oh so my code is created now I'll list start one by one so first I need the I'm using the h2 tag for writing the registration page listen page after registration page this will create the form contain method which method I am using the post and xn action I am good URL I'm just putting the URL or write the root root I'll just put where I went to pass the data so this is the registration page so I'm just going to pass the data to the registration Dot post so anywhere we have to define the registration dot post come to the web dot PHP station registration post registration post registration and the last name instead of calling this name you can call the this name also okay so this will work as early as now I am going to create the web form so first of all I will create my S CS RFID CSR csrf token then I'll just take the Dot com group and row class here I'll just take l a b e l label just example name and I'll just take the class here Plus MD 4 Dot on okay four eight eight depending so eight I'm taking here here I'll write input box type is equal to text name is very important very attributes here m is equal to I am just giving the name placeholder enter your name use the class I'm using the web let me run and check this one is coming on PlayStation yeah registration page name and there is a first name is coming so enter your name similarly I'll do it with the other okay this div email and password this is the name email last one is a word and last that I will use input type is equal to submit equal to class maybe I'll use the vtn button vtn Dash SU ccess hello these things are completed let me check the page so registration page name email password and there is a submit button now whenever it will submit it will just redact to the registration dot post so here is my registration dot post Define post registration create one function and I'll just create the post registration okay and post registration here I'll get the request dollar of dollar of request I am getting the request let me check with the DD command that I am getting all the requests or not always try check with the DT command display and die so here all refresh filler commit registration paste it here I have to write the post from it so I'm getting the data okay I'm getting name email there's a password and submit these things I am getting now login registration and login in registration are coming now we have a log out also but that will come after the login so here I'll just create the code to insert the data into the my database this is the for the Post registration so I have come to the controller I'm getting all the data we don't have issue with the data so first I'll go for the validation so dollar Rock request validate parallel Define one by one so first is name required for request second is email is required trust last is password is required so email I am just putting the required then it should be email email format then unique in my table users so email should be unique in the table user and password password is required and I'm just giving the minimum character it X I'm just reading I'm going to read all the data and passing to the one function create so dollar of data is equal to request all all the data in the data variable gate user create and I'll pass the data here I'll create a function yes probably public function create and get the arrayhead area of area of dollar of data here I'll just write the insert code so return directory and I'll write user create and here I'll just give the name name solar data up similarly L2 name name there is a password I'm using password is the last there is in so I have inserted all the commands means created uh there is a name email password after creating This One automatically return to the parent row parent method so here I will write the return EU return redirect I'm going to redirect this one to my login page with the message with with success [Music] in I'm just passing to the login page and with success bar this you are registered successfully in login page you will get this one and let me create the login page also same code I can use the code let me Define the error messages also then I'll move to at the rate directly I can call the error if there is a dollar of errors Edge in if error has a name then I just I'll just call the Ranger so here and exchanger I'll just display the error here color of errors similar I'll do with the other field put the email in this copy this and I'm going to use into my login page so right again page add I don't want the name is this this one my email so email I want enter your email address enter email and there is your password and here I'll use the login post login course so when I'll use the login post and one more thing just get the Json here person Edge access then class is equal to this any alert will come then here I'll just message this that's it so let me go to the registration and complete the registration then only then we'll move to the other part where I'm going to put the resolution what I'm putting let me here we have to use the we have to define the controller and switch con uh sorry method because I am using the user method here so I'll use huge app Plus model slash user controller request and we need the auth also huge press s u double P the support yes X Library I'm calling here we need the Json so I'll use the session let me run so I'm getting the login page login post is not defined login post first request dollar of request then I will just validate all the field will it embedded email and password so there is a help read it only required mail and the unique one minimum character and post there required an email so my validation switched completed next I'll just check with the credit sales so [Music] login equal to request play and pass the email I am just going to check here if path or to attempt and advise the check login credential check login credentials pause this one get login creating sales keep success derive to return Reddit dashboard and otherwise return to login with valid login credence okay you're successfully logged in and sure think correct your login credentials are incorrect let me check with that login so here I'm putting the pass username and something password to submit and get your login gradient sensor in correction let me check with the my login login details there is a login password is there put so dashboard the page is not found and what we logged in so let me create the dashboard page public ation as code path yeah I'll check the authentication here if there is Success then return you up dashboard and else [Music] star yes dashboard so I am able to see the my dashboard page so here this is chirag Jordan home other pages are there and there is a log out so I need the we got the log out so here we got all the things winter when I click on the logout is not the time to login now I am able to see login and registration when I am going to login correct when I'm logged in there is automatically coming with the log out so in this way we can create the login registration and logout with the PHP laravel 10 and these are the steps all the follow all the step you will get the solution and don't forget to follow like and share and subscribe there and subscribe thank you for watching hope this will help
Info
Channel: Chirags Tutorial
Views: 4,675
Rating: undefined out of 5
Keywords: chirags, chirags Tutorial, chirags Laravel Tutorial, chirags LaravelTutorial, Laravel Tutorial, Laravel 10, laravel course, install laravel, laravel tutorial, laravel php, login register in laravel, Laravel Chirags, Chirags PHP Laravel, Laravel Basic Tutorial
Id: Rxq72bOHVyQ
Channel Id: undefined
Length: 52min 23sec (3143 seconds)
Published: Fri Jun 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.