Laravel 8 Hospital Management System Project Tutorial For Beginners Step By Step From Scratch

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone this is yamin and welcome to laravel hospital management system project now in this t12 series we are going to see how we can create a hospital management system in laravel so before we dive into creating our laravel project let me just give you a quick overview what we'll have in this project so first of all we'll have two type of user one will be regular user and another on will be the admin so let me just talk about the user first now user will have a login and registration option so user can register and also can log in and over here at the town you can see make an appointment option over here so uh if the user is not logged in they can make a appointment and also if the user is logged in they can also make an appointment but what will be the benefit of the logged in user and that will be that if the user is logged in then they will have a on extra field over here which will be called view appointment so if the user click the view appointment they will be able to see how many uh apartment they book and user will also have the privilege to cancel or delete the appointment by their own so that will be the benefit that logged in user will get and now let's talk about the admin hot admin can do in this uh hospital management project so for for admin dashboard we will use this template now on the left side we'll have some option for adding employee employee means regular stuff or doctor and admin will also be able to assign salary for the employee and and admin will also be able to update or delete all the employee now admin will also require one more option which is book appointment uh like the user now let's say if someone called the hospital then admin should have the ability to uh book a appointment so admin will also have the option to create a appointment and also if someone book an appointment from uh from this user base then admin will also be able to see all the appointments and confirm or cancel their appointment as well so this will be everything about this uh project so if you want to learn laravel or create a playable project for your university this is the perfect project for you i would highly recommend you to follow this tutorial series now before creating our larabel project we need to have samp and composer installed in our pc now for installing xampp you just need to search for town exam download and if you just go to the first link you can see over here a lot of download link over here you can see download for windows and linux and i would also always recommend you to always download the most latest version from here if you just click download then it will automatically start downloading and the installation is really simple you just need to click next next and then finish so once you download the app uh you need to download composer for getting larabel project just search for composer download and if you just go to this link composer and just click this download link over here and then over here you will see a composer setup.exe if you click it it will start download automatically and then installing it is also really simple just click next and finish okay so once you uh download xampp and composer you are ready to create your laravel project so i am going to create my laravel project so for this lets go to our file and i'm going to create a laravel project inside my new volume f and it will be inside this youtube folder and over here at the top i'm just going to say over here cmd and press enter now creating laravel project we need to just give a command so we'll say composer then create then this minus sign will say project then we'll say laravel then slash laravel and after this we need to give our project name you can name it anything you want since we are creating hospital management system so we say host picture so if you press enter it will start creating our laravel project it will like take five to ten minutes to create our project so here you can see our project is created it's done so let me just close this one and over here in the youtube folder you can see we have another folder called hospital so if you go inside you will see a lot of file over here like this so here we are just going to say again cmd and press enter and then uh in the cmd we will say php rtsun serve and press enter so here you can see a link so let me just copy this ctrl c and i'll paste it over here ctrl v and press enter so here we can see this is our laravel project now let me just open our laravel project using sublime text so for this tutorial i'm going to use sublime text you can use any editor you want you can use visual studio or atom anything so for opening our project you need to click file then you we have to click open folder and then we'll go to local disk f then we'll go to youtube and here you can see hospital just click hospital and click select folder so here you can see our project is open here you can see hospital now we'll directly go to dot env and over here you can see our database name is laravel so we are going to change it so let's say our database name will be hospital and the username will be root and and the password will be null you can uh give the database name anything you want we'll give hospital so let's save it now and now we'll get this database so uh for this you first of all you need to have your exam started and now we will go to our pscm admin which is this one then we are going to click new and here you can see we have to give a database name over here so we will see over here hospital and we will click create so here you can see we have a new database called hospital so now uh we set up our laravel project and our database now in this tutorial i'm going to show you how you can create a registration and login for both user and the admin so for this uh for creating registration and login we are going to use laravel jsteam we are going to use those command you can see uh you can see over here some command uh after this uh this command at the fifth step we will make some changes in our table and the last command will be psp audition migrate so let's get started so first of all we'll go to our project directory again and we'll go to hospital and over here we're going to open another cmd and here you can see here our first command will be composer required laravel slash jsteam so let me just write over here composer require laravel slash jet stream and if you press enter it will uh install the recover file so it will take like five minutes so you can see that all the necessary package is uh installed now we need to write our second command which is this one psp audition jsteam clone install liver so i am going to say over here php rtson jstream then this clone will say install liver life w i r and if we press enter it will again uh install some necessary files so here you can see libor is also installed now uh here you can see please execute npm install and npm run the power here so if you go to our notepad you can see over here our command npm installed and then npm run dev so now we are going to say npm install and press enter it will take like five minutes to install it after npm install we'll say npm rounder npm run dev and we press enter now this command will take like 10 minutes to install npm run dev is also done now if you go to our notepad here you can see our fifth step is uh changes in the table so let's go back to our code and here you can see uh we'll directly go to database and inside database migration and inside migration you can see a lot of table over here we'll directly go to our user table which is this one so here you can see uh we have name email and password and some other field so we are going to add three more field over here so let me just copy one of them ctrl c so after email uh we'll have user phone number address and the user type user type means it will be regular user or admin so let's just first give phone number let's say just phone and let's say it will be nullable we'll give this arrow sign will say now apple and let me just copy this null level control c and paste it over here now after phone will have address and after address we'll have let's say user type and let's say its default value will be 0 its default value will be 0 let's say 0 means uh will consider 0 means regular user and on means admin so let's save it ctrl s now our now our fifth step will be psp addition might get this command so let's go back to our command prompt and we'll say php rtson migrate and if you press enter it will migrate all the table in our database so here you can see all the table is migrated now if we go to our database let me just refresh over here and here you can see our hospital table uh if you click plus here you can see we have a lot of table inside this database and if you go inside the user table you can see name email phone address user type and every other data over here so now let me just also also show you one more thing if we refresh over here we'll see a login and registration option over here so here you can see login and register option so if you click register you can see name email and password field over here so we are going to add two more field over here which will be phone and address so for making changes over here we need to go back to our code and then we have to go to resource and insert resource views and inside views you can see a auth folder over here then inside auth you can see login and register so we'll directly go to register.blade.php and if you go down uh you can see over here email and password field and name field so let me just copy this one this name field ctrl c and i'll paste it over here two times ctrl v now this time instead of name we say phone so let me just select everywhere you just need to click control and if you just right click uh everywhere it will automatically select so now we will be able to change every name atoms with our hairphone this name required to phone so after phone will have address so let me just select again control and just left click on them and we'll say here address so if you save it now and if we refresh here you can see we have two more field right now phone and address now we also need to make some changes so that we can send phone and address in our database so for it so now we need to go to app then action and inside action you can see fortify and here you can see create new user dot php so over here uh lara will actually create the user and here you can see some input field name email and password so we are going to add phone and address over here so let me just copy this one ctrl c and i'll paste it to time so instead of email we say phone phone and inside this input will say phone let me just explain now this phone this variable is actually coming from register.php here you can see our name equal to phone and in this phone is actually coming from the database uh here you can see phone so this one is actually this one so after phone we have address and address so let me say address again so let's save it now control s now we need to go inside app then models here you can see models and inside model we have user.php so we need to add we so we only have name email and password fill over here so we will add phone and address field here as well if you don't give it uh it will create some problem so control v control v so we'll say here phone and address and let's save it now control s and let me just refresh here and let's keep the name let's say name equal to user and email equal to user attract of gmail.com let's give a phone number and let's give a address let's say and let's get a password and if you click register it will register our account so here you can see we are now in our dashboard now if you go to our database and if you just refresh here you can see we have a name email then user address and our user type is zero by default and which we mention over here you can see by default its value will be zero so let me just uh log out from here and login again and register again for admin so if you click register then we'll say here admin then email will be administrate of gmail.com let's keep your phone number and address let's say random things let's give the password and if you click register uh here you can see the dashboard now we are going to make some changes in the database so let me just refresh now so here you can see user type is by default zero for admin as well so now we click edit and instead of uh user type 0 will say user type on so now we'll go down and here you can see go option will click go so now here you can see that the user type is changed to on so now let's go back to our code again now we are going to make some changes in our code so that if the user login then it will take us to user dashboard and if the admin login then it will take us to admin dashboard so for it we'll go to app then inside app will have providers if you click providers you can see over here route service providers just click on it and then here you can see public const home equal to dashboard so instead of dashboard let's say we say here home you can say anything you can say redirect or anything you want so we'll just say home then uh we'll go to our web dot php routes then we've got php and we'll create this uh route in the dot php so here uh we are just going to create another route so we say route then this double clone then first bracket and inside to double quotation we'll say slash home then we'll give a comma to third bracket and inside it will say home controller then double clone will say class then we have to give a comma and after this we'll give it two single quotation and we need to mention the function name and we'll say here function name will be redirect let's say so let's save it now we also don't have this home controller so we need to create this home controller so for it let's go back to our command prompt again and for creating a controller we just need to say php rtson make then this clone controller then we say home controller and if we press enter it will create a controller okay it's giving me a error okay here you can see route okay we have we need to write over here get so we'll say here okay and i also forgot to give a semicolon over here so let's save it now ctrl s now let's go back to our command prompt and let me see over here again psp addition make clone controller home controller and if you press enter you can see here controller created successfully the message and if you go to our controller if you go to app then http then controllers here you can see home controller dot php now we also need to mention this home controller in our web.php at the top so at the top we need to say use app backslash http then backslash controllers backslash it will be home controller so let's save it now control s now we will go to our home controller and create this redirect function so let's go to homecontroller.php and here we're going to say public function redirect and inside it will give 2 second bracket and here we are going to first check if there is any auth id so first uh we'll give a if condition then we'll say auth double clone will say id so if there is any auth id then we will have this condition and let's also write the else condition else and and inside s we'll just say return return redirect then to first bracket this arrow sign will say return derived back so over here inside this if condition if there is any authority it means there is if there is any user trying to logged in but then we will check what is the user type i mean here if you go to database here you can see we have the user type 0 for regular user and on for admin so we'll first check uh their user type so we'll say now inside this if condition we are going to say auth then double clone will say user which is our table name then we'll give two first bracket then we'll give this arrow sign then we'll say user type which is our column name and we'll say if this equal equal let's say if this equal equal on then it will take us to this dashboard let's say return there's a return view and inside it will say dashboard and this dashboard is actually uh is actually if you go to our resource here you can see dashboard uh this is the dashboard that we see after uh we log in so after this if condition will give another condition which is else and over here uh the thing is if the user type is not 0 it means if the user type is on uh here you can see our user type is 0 and on so if the user type is not 0 it means the user type is on if the user type is on then it will return a different view so it will say return then let's return view will say let's say admin dot home so let me just save it now control s and one more thing that is we are using auth and also the user table so we also need to mention them at the top so let me just uh copy this use illuminate http slash request so we are going to say use illuminate backslash we are going to say support then backslash it will be faked then backslash it will be auth and after this we also need to mention the table name which is uh the user table which is so we'll say app then backslash we'll say models backslash user if you go to our uh app then you can see inside app we have models and here you can see user.php which we just mentioned over here so let's save it now and let's go back to our browser and let me just log out from here now admin part isn't complete now i just i'm just trying to show you that uh user logging is working so if you click login and if you give the user email and the password and if you click login so here you can see uh in the url uh before it was redirect now it is home so this is the user dashboard we will make some changes over here but first uh let's create our admin dashboard but before that i also like to mention uh some more thing about this dashboard now this dashboard is actually uh if you go to our views and inside views you can see dashboard.play.php everything is actually coming from here so uh actually this two line this exact layout and this closing is the most important line uh let me just remove this one and if you just save it and if you just refresh here you can see we have the dashboard and the logout option over here so i'm just showing you this because after a few minutes i will be working with this one so now let's just create a admin home so let's go to our home controller dot php and here you can see you're returning a view admin.home now we do not have this admin.home so first of all we will go to our resource then views just uh right click on it and then i will create a folder click new folder and we'll say here admin and press enter and inside this admin folder we're going to right click and click new file and we are going to say home dot play dot php and ctrl s then save and over here i'm just going to copy some code from the let's say uh from the dashboard.blade.php here you can see dashboard.blade.php i'm just going to copy this to line ctrl c and ctrl v now inside this we are just going to mention a uh h on tag let's say inside this uh we'll say this is admin dashboard and let me just and let me just save it now and let's uh let me just log out from here and let's click login again and if we say admin.gmail.com and if you give the password and click login you can see over here a message called this is the admin dashboard now now here you can see in the background uh the color is different and in the future for making this tutorial we also don't need this logo and this dashboard right hand over here so we are going to remove it uh for it we need to go to our code and then we have to go to our navigationmenu.blade.php and here you can see that here you can see a navigation link over here so let me just remove this and if you go up you can see a logo written over here so let me also remove this so if we save it now and if we refresh this two thing will be gone so let's refresh so as you can see there is no navigation and the log over here now let's remove this color so for remove this color we need to go to layouts then we have to go to app.play.php and if you go down you can see that there is a at line 24 there is a class mentioned over here mean is bg gray hundred so if you just remove this class and save it and if you refresh the color will be gone on the from the background so this was all now let me just make another changes uh now if you go to our home homecontroller.php here you can see you are returning the dashboard view for user let me just do it the same way that we did for the admin we will say instead of dashboard we say user dot home so let's go to our views and inside the fuse we are going to create another folder we'll say user and press enter and inside user let's again right click then click new file we are going to say home dot plate dot php and save it control s and save now let me just copy the code code from the admin home so let me just copy this control c and i'll paste it over here and we'll say here user home so let's save it now and let's check if it's working or not so let's log out and let's login now we login to user dashboard so let's go to user give the password login so here you can see currently we are in user dashboard now in this tutorial i am going to import a our template in our project so this is the template we are going to import in our project so i am going to keep this link in the description so that you can download it from there so if you want to see the live demo you just need to click over here live demo and then you will be able to see how our template looks so we are going to uh download this template so for download this template we just need to click over here download and it will automatically start a download over here so you can see over here that ac file is downloaded and so first of all you need to extract the zip file that you downloaded so you just need to click right click on it and then you see over here extra here if you click it it will extract this zip file so you can see uh the zip file is extract so we need to go inside this and here you can see asset and html so from here uh we just need to copy uh copy this html and this asset both of them so let me just copy it copy so after you copy this uh you need to go to your project uh let me just go to my project directory so here you can see hospital so we'll go inside hospital then you can see a public folder we need to go inside public folder and we need to paste uh all the files that we copied from here so i am just going to paste everything inside this public folder so paste so here you can see two new folder asset and html now if you go to a sublime text then and if you go to the public folder you will see our two more folder asset and html now inside html you can see index.html now all the template that if you download from internet uh everything is start from index.html so i'm just going to copy everything uh inside this index.html so ctrl a ctrl c then we'll go to our resource then we'll go to you views then users and inside users we have home.play.php and over here you can see except layout and we are going to remove this for now we'll use it after a little while so for now we'll just remove it and paste the code that we copied before so if we save it now now this is the code for our this template so what i want is that uh when someone go inside our project i on the user to see this view first so for it uh let's go back to our route first we will go to route then web.php and let me just copy this ctrl c and i will say over here control v so now in order to show uh this template to the root view we need to say over here only slash and in the home controller we need to mention a function name let's say index let's save it control s and here you can see we have another route gate we need to remove this so let's remove it now let's save it now we'll go to our home controller app controller home controller and inside it we are going to say public function index and here we are just going to return a simple view so we will just say return view and we are going to say user dot home so if we save it now and if we refresh over here so here you can see our template perfectly so first of all we need to fix this uh login and registration option because so that our user can log in and register so let's fix this first let's go back to our code again and if you go down uh at line 86 you can see over here we have login slash register so let me just make separate option for login and register so let me just remove this so now let me just copy this li ctrl c then uh ctrl v and over here instead of login we'll say register register and if we save it and if we refresh over here you can see we have a now login and register a separate option now if you click login it doesn't take us to our login or or if you click register it doesn't take us to our register page so for it uh we need to write inside this href we just need to give two second bracket and inside it we need we'll say route and to first bracket to single quotation and if we just say login it will take us to login page now a lara will give us this option if we just say this route login and if someone click the login button it will take us to the login page the same goes for the register as well if you just see over here route and inside to first bracket uh if we say register and if we save it so and if we refresh over here and if you now click this login button it will take us to login page and if you click this register button it taking us to the register place now let me just uh try to login from here so if you click login and let's keep the user and let's give the password and if you click login it will take us to the same pace here you can see uh because if you go to our home controller uh here you go you can see at the redirect function for user we are returning this user.homeview and our index view is also user dot home if you uh check over here uh at the top you can see we have slash home at the top so somehow we need to do something so that user can understand that uh he is logged in so for it let's go back to our code again and we'll go to our home.play.php again and before this uh login we are going to give a if condition we'll say at that of if then inside first bracket we'll say route double clone has inside to first bracket we'll say login if there is any logged in if there is any login then we'll say at the top we'll check the auth and then uh inside let's say here inside this auth now you for this auth condition let's say user is logged in so and if there is no auth or if there is no user is logged in then we will go to s condition we will say else we will go to else condition so if there is an no logged in user then it will show us login and register but if there is any logged in user it will show us this message so we also need to in this uh if condition and auth condition so we will say after this register list we say at that of first we need to in the auth we'll say auth now we say at that of int if so if we save it and let's refresh here so here you can see user is logged in so we are not seeing the login or registration option over here but this isn't right we need a logout option so that the user can log out so for it uh let's go back to our code again now we will go to our dashboard.play.php and here you can see two line this two line is actually responsible for creating a logout option so let me just copy it and we'll paste it uh inside this auth condition so let me just remove this h on and we say ctrl v and ctrl s so if you now refresh over here you can see here a logged out option for user if you click this button you can see logout option and if you click profile you can see some some other option for changing password and you can there is also a delete account option over here now this is actually created by the laravel so now if we log out from here click log out you will be able to see the login and register option over here so now the main part is done so now let's just uh structure our template or or you can say home.blade.php whatever you want so uh we are going to divide this page code so that we can simply understand those code really easily so let me just show you uh here if you go to our template here you can see all the doctor images over here so let's find the doctor code part so here you can see this is the doctor section if we just remove it let me just cut it from here ctrl x and let me just uh let me just give a equal sign over here and if we save it now and let's just refresh so here you can see equal sign that doctor part is gone so uh we are going to create another file uh inside inside this user folder so we are just going to right click over here and we are going to click new file then here we are going to say uh doctor dot play dot php and let's save it ctrl s and save so we are going to paste everything that we copied ctrl v ctrl s now we are going to our home.blade.php again and instead of this we are going to say add the data include and inside it we are going to say now you can see our home our doctor.blade.php is actually inside a user folder so we say user dot doctor so if we save it now control s and if we refresh so here you can see the doctor part is back so we are going to do the same for uh some other part latest news and make an appointment so let me just uh make a separate option for uh make an appointment so let's go back to our code again and this time we will uh copy the appointment part so here you can see this is the appointment part make an appointment so let me just copy this part uh ctrl x and ctrl s let me just keep it let's say something and if you save it now and if we refresh this apartment part will be gone so you can see there is no appointment part you can see the 555 here so we are going to create appointment file inside user folder so click new file then we'll see over here appointment dot led dot php and save it control s save control v control s now we will go to home.blade.php and here we are just going to say at that of include so we are going to say user dot appointment so if we save it now and if we refresh here and if you go down here you can see make an apartment is still here and let's just remove this part we do not record this part so let me just remove this part ctrl s and let's refresh okay now this is all now if you want to like have the other part like latest news or this footer in different file you can do it as well i already show you how you can do it now let me just uh have this latest news in different file as well so this time i am just going to copy everything for the latest part control x and then we'll create a folder for latest let's see over here latest it is dot player dot php so ctrl s save ctrl v ctrl s now we will go to uh we'll just say at that top include and then we'll say user dot latest save it and let's refresh so you can see the latest part is still here so this is all for this tutorial in this tutorial we are going to add a admin template in our project so let me just first log in and go to our admin dashboard so if you just say over here add pin and keep the password and click login it will take us to admin dashboard so here you can see this is our admin dashboard and there is nothing over here we just have a logout option over here you can see profile and logout so we are going to have a admin template in this page so we are going to use this template uh this template is called corona free so we are going to uh import this admin template in our project so if you go to this website pushtab dash.com you will see this template and you can download this template for fish so i will give you the download link in the description box so that you can download it from there so if you are following this hospital management system tutorial series then i would recommend you to download this template because then it will be easier for you to follow my tutorial uh so in order to download this template all you need to do is that click download option over here and it will take you to another page uh to a github page and over here you can see this is the template so in order to download it you need to click the code and if you just click download zip it will download it start downloading a zip file over here you can see so here you can see that our template is downloaded so we need to uh go to the full download folder here you can see the template corona dot free bootstrap admin template so first of all we need to extract this template so you just need to right click over here and then click extract here so here you can see extract is done uh you can see a new folder over here so if you go inside you can see documentation and template so we'll directly go to template so inside template you can see asset if you go inside asset you can see some css and here you can see pages and inside partial maybe there is some more css or footer actually so uh we are going to copy uh every file inside this template folder so let me just copy it copy now we need to paste this code in our project public folder so let me just go to our project which is this one hospital is our project name and now we'll go to our public folder and if you go to public folder you can see there is already a asset folder over here so here you can see in the template we also have the asset folder so what we are going to do is that in our project public folder we are going to create another folder over here and we will name it admin and inside this admin folder we are going to paste all the file that we copied now here you can see all the file or folder that we copied is now inside this admin folder so now if we go to our code and if we go to the public folder here you can see admin folder and if you go inside admin folder here you can see all that file asset uh not my rules space now we will directly go to index.html because if you download any template from internet or anywhere that template always start with the index index file so for it uh let me just uh first of all will copy everything that we have in this index.html so ctrl a ctrl c now i will go to our resource and here you can see admin folder and inside admin you can see home.blade.php and here you can see x app layout and uh and the closing of xf layout and inside it you can see this is admin dashboard so this uh this except layout is actually responsible for for our this profile and logout option and here you can also see this is admin dashboard so what we are going to do is that we are going to paste all the code that we copied from index.html so ctrl v ctrl s and if we refresh now over here you will see some view but without any design so here you can see some uh logo and everything else over here but there is no css or design because uh because before we create an admin folder and we paste all the template file or folder inside this admin folder so if we go to our uh home.blade.php here you can see uh link is equal to srep asset now before this asset we need to say admin slash so let me just select every asset uh so for it you need to click ctrl and if you just left click then it will automatically select uh let me just select every href and if you go down you can see there are some more hdf over here and here you can also see for for images there are also some assets or you can say source now we'll just say over here admin then we'll give slash so here you can see everywhere is chance here you can see everywhere is admin slash so let's save it now we'll go down and add the in you can see that uh there are also some skip source over here you can see skip source is equal to asset so let me also select over here as well and once we are done selecting every asset uh we'll just say admin slash so let's save it ctrl s and if we refresh now over here you can see the dashboard now here you can see there is no logout option over here but we'll fix it later but first of all now let me just simplify our uh admin dashboard before we'll have the network the sidebar and also the body part in different file so let me just show you we'll go back to our code and here you can see there is a lot of code over here now it is really tough if we want to like change anything we should actually have them in different files so that we can understand our code really easily so let me just first uh let's have our navbar on different page so so here you can see at the line 176 our network started from here so let me just copy it from here and our never end at the line uh 369 over here you can see slash snapper so it indeed over here so let me just uh cut it from here ctrl x so if we save it now and if we just refresh over here the navbar will be gone so since the network is not here you can see the logout option over here right now so what we are going to do is that uh we will create another file inside our admin so let's click right click on it then click new file and here we are going to say uh nav nav bar dot led dot php let's say control s save and inside it we are going to paste all the code that we copied let's save it now and now we will go to our home.blade.php again and here we are just going to say at the rate of include and inside it we are going to say admin dot will say nav bar so if we save it uh so now here you can see we said include admin.navbar it means it actually calling this snapbar file or if you can say it's actually inheriting the navma.blade.php so if you now refresh over here you will see the nav for like before so here you can see after this now we are going to copy the sidebar then we will copy the uh body part so let me just copy the sidebar first so uh if you go up here you can see it's right a sidebar dot html so let me just copy this on a from here and we'll cop copy up until this documentation part so control x now if we save it and if we refresh here you can see there is no sidebar over here uh so let me just go to go vector code and we'll create another file inside admin folder we'll say sidebar dot blade dot php and let's save it ctrl s save and we are going to paste all the code that we copied okay so let's save it now control s now we'll go to home.blade.php and again we're just going to say at the rate of include and inside it we are going to say uh admin dot sidebar side part so let's save it ctrl s and if we refresh now you can see all the sidebar is back now let's do the same for the body as well and we'll also fix this uh this part as well but it will be at the end so let's go back to our code again and this time we'll copy the body part so it started from line 40 on so let me just copy everything from here okay so let's copy it uh ctrl x and ctrl s now if we refresh the body will be empty you can see there is nothing in the body so let's go back to code and inside admin folder with a new file we'll say body dot plate dot php control s then save and inside it we are going to paste every code then we will go to home.blade.php we say at that of include and we say uh admin dot body save it ctrl s and let's refresh so you can see the body part is back now let's go and let's fix our logout option now if we go back to our code again and if we go at the top of our home.blade.php you can see that uh this is the part which is responsible for creating the logout option so we are just going to copy this to line of code control control x and now we will go to our navbar.please.php and here you can see a logout option from the template so we are going to remove this and we are going to have our own logout option so let's go to our network.blade.php then uh we need to find this uh hindi claim so let's go back and and and here you can see henley claim uh he started from here uh this list started from here and this li indeed uh let me check indeed over here so let's remove it and uh over here we are just going to say say this control v we're going to say this exactly i would close except layout if we save it and if we refresh now here you can see our logout option for admin now uh you can also change the design if you want so here you can see some white background color if you want to change its color then you have to go back to your code and then you have to go to navigationmenu.play.php and at the top you can see nab x data and here there is a class mentioned over here if you just remove this class and if you save it now and if you refresh you can see there is no background color right now so there's also a logout option now let's check if the logout works if you click log out okay it taking us to this page now in this tutorial we are going to add doctors details from the admin uh dashboard so let's go and first log into our admin dashboard so we are going to give the admin email and the password and if we click login so here you can see this is our admin dashboard so first of all uh we'll directly go to this sidebar option and we're going to make some changes so that we can uh we will have an option so that we can import a doctor's data in our table so let's go back to our code and here you can see resource then we'll go to views and you can see admin and inside admin we have sidebar dot play dot php so here you can see that we have a lot of option in the sidebar so uh here you can see the sidebar started with uh dashboard and indeed with documentation so we're just going to keep only on a list over here so here you can see the dashboard it started from here the list so let me just remove everything and we'll just keep this only the last time documentation so let's save it now and if we refresh here you can see only the documentation part so in the documentation uh let me just remove this href and instead of documentation we're going to say uh add doctors and if you save it now and if we refresh you can see add doctors option over here so we are going to say uh inside this hdf we are going to mention a route so we will give two second bracket and inside it will say url and we are going to give two single quotation and then we will say uh let's say add underscore uh doctor underscore view so first of all we need to create a view uh i mean we need to create some input field so that we can upload or insert doctors data in our database so let's save it now and we'll go to our route then web.php then we'll create this url so let me go to our web.php and here i'm just going to copy this route ctrl c then ctrl v and here uh in this case uh we are going to say add underscore doctor underscore view and instead of home controller we are going to say admin controller since we are uh we want to upload data from the admin dashboard and we also need to give the function name let's say here uh let's say only add view or you can say upload view so let's go with the add view so let's save it ctrl s now uh first of all we will create this admin controller so let's open the cmd and for getting admin controller we just need to say php artisan make clone uh controller then admin controller and if we press enter it will create a controller you can see controller creator successfully if we now go to our app then http then controllers here you can see admin controller so let's go to our admin controller and here we're just going to save public function and add view which was our function name in the web.php and here we are just going to return a view so we'll say return view and inside it we're going to mention a view so we'll just say admin dot uh let's say add underscore doctor so we'll uh create a file uh at doctor.blade.php inside our uh admin folder so let's save it and now we'll go to our admin folder here you can see inside view we have our admin folder and we'll just right click over here then click new file and here we are going to say add underscore doctor dot play dot php so save it control s uh then save and here uh let me just copy some code from our home.blade.php now this home.php is actually uh this total view so let me just uh have this uh css and this uh skip part in the uh other files just with it uh in the previous tutorial so let me just create another file over here so i'll click new file then i'm just going to say css.blade.php and save it control s save and we're going to go to home.blade.p and and i'm just going to copy everything uh from this head so let me just copy it i mean the cut it control x and i'm going to paste everything in the css.bit.php so ctrl v control s and in the home.play.php inside head we are going to say at the top include then admin dot css let's save it and we're going to do the same for the skip part as well so let me cut the skip as well uh ctrl x and again we'll create another folder a new file with script dot play dot php save it ctrl s then save and i'm going to paste everything every skip code so we save it now and we'll go to home controller and again we'll say at the top include and inside it we are going to say admin dot skip okay i did a spelling mistake it will be admin and let me go top okay we also need to give a single quotation over here so let's save it and let me check uh if everything is fine so let's refresh okay so everything is fine now let's go back to code again and this time uh what we are going to do is that we are going to copy everything from the home.blade.php so ctrl a ctrl c and we are going to paste this uh code inside our adddoctors.blade.php so paste it over here and if we save it now uh let me just remove this admin dot body part so if we remove it and we'll save it and this time let's refresh again and if you click the add doctor uh you will see okay admin controller does not exist so let me go to our web.php and at the top we need to add the admin controller control v and we'll say admin so let's save it and now let's refresh so here you can see uh this is actually dr view at the top you can see at underscore doctor underscore view so here we are going to create some input field so that uh we can upload doctors data in the database so let's go back to code and now let me just show you one thing uh if you just write h on and inside on inside h on let's say here add doctor and if and if we save it and if we refresh here you cannot see any add doctor text over here uh the thing is if we go to our uh admin thenava.play.php and at the top you can see there is a deep class container fluid phase body body uh wrapper this is a class for this uh template so if you want to show anything inside the body ah then we have to give this uh div class over here otherwise we won't be able to see anything in the body part so if we just uh give this div over here and indeed if we save it now and if we refresh you will be able to see the add doctor over here you can see at the top at doctor so whatever uh design you want to make you have to write everything in the everything in this div ah so so let me just have another div over here send and inside this tip i am just going to say class is equal to container and let me just save it and here we are just going to have a form and in this form we will have some input field for doctor so let me just say form and then uh let's just say another div and inside this div we are going to we are going to have some level and input field so let's say here level so let's say it will be our doctor name [Music] and we also need an input field for doctor so let's say input so input type will be text and name equal to let's name it name equal to name and you can also have placeholder if you want let's say placeholder equal to uh right the name and if we save it now and if we refresh here you can see it's look like this and if you type anything you can see that uh the text color is high so that's why we cannot see it so what we are going to do is that uh we will just mention a class over here so we will just mention a style over here and we'll say color it will be uh let's say black you can have any color you want so save it and let's refresh and here you can see the text color is now black now let's just have this inside the middle so that it will uh look good then so here you can see a classical container so we are going to say here align it will be center and okay let's save it and let's refresh so it is in the center and let's also say uh here inside we let's mention the style and we say padding that's the padding prop it will be 50px save it and let's refresh okay there is a little bit gap over here you can see okay let's increase the gap as well so we are going to say instead of 50 we are going to say 100 and now inside this tip let's add a style here with the style and we are going to say padding it will be let's say 15 px let's save it and let me just copy this step ctrl c so a doctor will have his name uh in the database and also his phone number uh then the doctor speciality and after this uh let's say uh it will also have the the room number for the doctor's seat and let's say we will also have the doctor images as well and if you want you can add some more extra field and i think this is enough so doctor name after this we will have the phone number let's just let's just say phone and so the type will be number and and inside the placeholder let's say write the number and after number uh okay type is in um and let's say name equal to it will be number as well and after number uh we'll have the doctor specialty so in this uh level we are going to say let's just say specialty species specialty and this time instead of input field uh we are going to say uh select option here so we will say select and inside this select uh we'll say some option so let me just say here hello option has some values so let me just copy it ctrl c now there can be uh now there can be a lot of type of uh speciality doctor let's say uh it can be a skin doctor uh or heart doctor or it may be like eye doctor or let's say just uh let's just the nose okay so inside this uh value let me just say the same thing it will be skin after uh skin will have heart then i and let's say moss if you want you can add some more extra field and let me just add uh one more option here and here in this option we'll just say this hyphen hyphen uh select select hyphen hyphen so if we save it and let's see let's refresh and let's see how it looks so this is how it looks you can see that okay you cannot see the okay the text color is white so that's a problem so let's change the text color inside the select we are going to say style and we'll say color it will be black so save it and let's also uh mention with over here let's say width will be uh 200 px save it now and let's refresh okay there we is now almost the same so after specialty will have the uh doctor room number so we'll say doctor or let's say just room number and here the type will be text that's fine and in the placeholder we'll just say write the room number and we also need to mention the name let's say name will be room and here in the select we also need to mention a name here as well so name equal to spay speciality specialty and the last one will be the doctor image so let's just say doctor image and this time for image uh we need instead of input field we need to mention uh input type will be this time file and we also need to mention the name uh let's say name equal to okay file as well now after this image option we need to have a submit button so let me just copy this tip control c ctrl v and here okay the submit button doesn't require level so here input type will be submit and here let's just uh mention a booster class let's say classical btn ptn it will be a success save it now control s and let's refresh so this is how it looks now let's change that design a little bit more so let's go back to our code and and here you can see that that uh the level is not um at the same place so we'll make that uh all the label is at the same place so for it uh we will go at the top and inside this set we are going to mention a style and inside it we are just going to say dot all level then 2 second bracket and inside it will say display inline block and let's also say uh width will be 200 px save it okay we do not have to give the dot here so now let's save it and now let's refresh okay now this looks better so now we have a doctor name phone number speciality room number and doctor image input field now let's go and create a model or a table in our database so that we can upload all those data so for it we will go to directly to our common prompt and here we are going to say php rt sun may clone model then we are going to say our table name lets our table table name will be doctor they will uh or we can say model name will be doctor as well so we will say minus m so what will happen is that it will create a doctor model and a migration in the table at the same time so if you press enter you can see model is created successfully and there is also migration created as well so now if you go to our code and if you go to app then models here you can see doctor.php and if we go to our database then migration and inside migration you see a doctor table over here so let me just say over here dollar table and then this arrow sign will say string and inside this thing where we're going to set our doctor name uh let's just say her name and let's just say it nullable okay so now that's not a good practice that uh if we just give every in every column name column value is nullable but since we are learning so i think uh this fine this is fine so ctrl c and i'll paste it four times so after name let me just check we have phone number speciality room number and doctor image so here we are going to say phone then uh we'll have specialty speciality after this will have room number let's just say room and the last one will be image so let's save it control s now we will go to our uh command prompt and this time let me just say control c it will end it now we are going to say php rtson migrate and if you press enter you can see migration is successful now if you go to our database and let me just refresh here then you will see over here at the top you can see a doctor table so if you click it you can see name phone speciality room image so uh let's go back to our code and now we'll go to uh add doctor.please.php now we'll directly go to our form and how is the form okay here is the form and here we are going to say action uh and we'll also mention the method and after method we also need to say enc type why nc type because we also want to upload a file from here so we need to mention nc type so enc type will be multi-part then slash it will be form hyphen data and we also need to mention at the top csrf and now uh the method will be post since you want to upload data to the database and inside the action we say route and okay let's just say url instead of route inside this url we're going to say uh upload let's say upload doctor upload underscore doctor so let's save it uh so so now we'll go to our web.php and create this upload doctor route so let's go to web.php and let me just copy this control c and ctrl v and stop get this time it will be post and our url name was uh upload underscore doctor and let's see our function name will be just upload so now let's save it ctrl s now we will go to our uh admin controller and create this upload uh function so let's go to admin controller and here we are going to say public function upload and here uh then we just and inside this upload we need to mention request request then dollar let's say request request and who i request because we want to get the data from the at doctor.blade.php all those uh data you can see over here so first of all uh we will mention our table name so let's say here dollar uh let's say just doctor you can declare any variable you want we say dollar doctor is equal to new and we say doctor now this doctor is our table name and since we are using this doctor table so we need to add the doctor model at the top so we need to say use app backslash models backslash uh doctor so let's say we ctrl s now we're going to let's just uh try try to get the image uh from here first doctor image so for it now we'll declare a variable let's say here dollar image equal to we'll say dollar request this arrow sign then we'll say file now this file is coming from the adddoctor.blade.php so here you can see new equal to file so after this uh we are going to declare another variable so we'll say dollar let's say image name is equal to uh we'll set time then to first bracket after this we will say dot then to single quotation and inside the single quotation we need to give a dot then another dot dot mean full stop uh and after this dollar image this arrow sign will say then get capital c client okay client uh capital o original extension capital e x tension and it will into it to first bracket then semicolon and after this okay let me just write it over here like this and after this uh we are going to say dollar request arrow file and it will give another arrow and then we are going to say move and inside it we're going we we need to mention a folder name let's say doctor image then comma dollar image name now don't worry i'll explain it let me just write it first we'll just say dollar doctor this arrow sign image equal to uh this image name so we'll say dollar image name so let me just explain it uh what uh what is happening over here so first of all we are getting the uh file image file uh inside this variable then uh then we declare another variable image name equal to uh we are using actually a time function so that whenever we upload an image every image will have a different name uh depending on this time function and after this we are actually uh moving this file inside a folder called doctor image now this doctor image folder will be inside uh inside public folder now if you don't create this doctor image uh folder in the public whenever you upload a image it will automatically automatically create this doctor image folder in the public folder and inside that documents folder it will save the image here you can see image name and then ultimately we are actually sending this doctor image to our database so if you go to our database here you can see that we have a image so this is what we are calling we are calling doctor image equal to image name so we are actually sending this image uh to our database so after the image uh we are going to upload uh all the other data like name phone specialty room number so for it uh let me just we just have to say again dollar doctor then this arrow sign uh let's say here this time name is equal to dollar request this arrow sign name now this name is coming from adddoctor.blade.php here you can see doctrine name and name is equal to name after name we have the number so let me just uh copy this one ctrl c ctrl v now let me check it the number in the database here you can see okay it's phone so let's see here phone and this one will be number after number we have the room and specialty so let's see here room equal to room and specially t equal to specialty so uh in order to save it we just need to say dollar doctor this arrow sign save then to first bracket and after this we just we want to stay on the same page so we'll say return redirect back redirect to first bracket this arrow sign back so let me save it and let me check okay i have i hope there is no error so let's refresh here so now let's keep the doctor name uh let's say doctor nice yamin let's keep the phone number random phone number let's keep the specialty skin doctor and let's say room number 302 it means third floor second room and let's choose the image now let me check if i have an image okay i have a lot of image let me just choose a random one okay add a heading let me just choose it open so here you can see uh the image name add a heading so if you click submit it will refresh and there is error speciality uh okay unknowns column specialty now let's go check s p e c i a lty okay i need a spelling mistake here so we have to fix it in the admin controller s p e c i a lty uh so let me save it now and let me just uh refresh here okay we are now back to the same page now let me just refresh here so here you can see the name phone number uh speciality skin you can see the room number and the image here as well now if you go back to our code and if you go to our public folder let me just show you if you go to public folder you can see you can see a new folder over here talk dot image which we mention over here now we did not create this uh folder it automatically created over here so here you can see if you go inside you can see the image here as well so let me close it now there is one more thing that i want to mention is that whenever we are uploading a data or doctor uh in the database uh how can user be sure that uh we actually successfully upload the successfully uh insert a doctor so user is not going to like uh check that database every single time because user is not a programmer so we should show a message at the top that uh doctor is added successfully so for it let's go back to our controller first and here you can see return redirect back so we'll uh return the view with the message so we'll give a arrow sign this time and we'll say width and inside it will give two single quotation and we'll say message and then we give a comma and inside it we are going to say doctor added successfully and let me save it now we will go to our add doctor.blade.php and we need to catch that message so here uh you can see that okay inside this div we are going to mention a if condition uh we are going to say if and we are going to say if session session to first bracket this arrow sign has to first bracket to single quotation we are going to say message if there is any message let me just fast in this if condition will say at the top indeed and inside this if condition we are going to say going to mention a deep first uh inside this div let's just add a bootstrap class uh let's say classical to alert alert then a elliott alert alert success and inside it we are going to paste the message so we'll give two second bracket and inside it we are going to say session to first bracket then we need to say this arrow sign and we say get and inside this gate we are going to say message and this will show the message now we also need to add a uh close option close button option so that we can close the message so it's a button and let's say inside it button type will be button and it it will have a class class will be classical to let's say close and we also say data then this minus uh dismiss equal to and uh inside this button we'll just give a x let me just cut this if condition ctrl x and i'll paste this uh if condition after this class container so control v control s and oh there's a spelling mistake success su uh double c double s so now let's save it and let's refresh again and let me just keep the name again let's say yeah here this time let's keep the phone number random phone number especially it knows room number 504 let's choose the image click open then submit okay doctor added successfully now there is uh one more thing i want to fix is that uh we will go to add doctor.date.php and we'll have all the field uh input field is required so we say required so let me just copy it ctrl c and let me just select every input field select then uh this one and this one as well so ctrl v control s now let's refresh and right now we cannot submit data without giving every data over here now in this tutorial we are going to show all the doctoral images their name and their speciality uh to our home page so so for it let's go back to our code and we'll directly go to our views then uh you can see user then home.play.php so uh if you go down in the home.blade.php you can you can see that uh we are getting the doctor's details uh in this home page from different file uh it is uh from doctor.blade.php which is inside user so we'll directly go to user then doctor.blade.php and over here you can see that there is a doctor a lot of lot of doctor images their name their specialty over here so we are just going to keep only on off uh the doctor image and the specialty and we are going to remove the rest of them so here you can see that uh the class deep class item uh started from here and it ended over here so we are going to keep only this one this d plus item and i'm just going to remove every other of them so let me just remove and will and this item ended over here so there will be so there will be three closing div at the end and three three opening div at the beginning so right now we need to go to our controller home controller uh so let's go to our controller then homecontroller.php and here you can see that uh from this redirect function we are returning uh home home view and also from this index function we are returning user dot home view so let's work with this index view first so over here we are just going to say uh first of all declare a variable let's say dollar doctor you can declare any variable you want we'll go with doctor then we need to say our table name and our table name is doctor if you go to our browser and over here you can see that our table name is doctor so we say doctor then we'll give to clone then we'll say all it means we want to get all the data from the doctor table and we want to send all this data to our home page so for it we need to say comma compact then to first bracket and inside it we need to mention this variable since this variable contains all the uh data that we have in the doctor table so we say doctor and since we are using this doctor table so we need to add the doctor model at the top so let me just copy this user model and paste it here and instruct user will say doctor so let's save it control s and now we need to go to our doctor.blade.php and here we are going to cache all the data that we send from the uh home controller so here before this uh diff class item we are going to say uh at the rate of for each and inside first bracket we will say dollar doctor then as dollar let's say doctor and this for each loop will end over here will say at the rate of in for each now here you can see we have the doctor image here doctrine name and doctor speciality so first of all let's write the doctor image so we'll give two second bracket and inside it we're going to say this uh this dollar doctors so we'll say dollar doctors then this arrow sign then we say name now if you go to our database you can see that uh doctor name is name then we have the doctor speciality and here you can see also the image so after name will write specialty let me just copy it ctrl c ctrl v and it will be special it is p e c i a lty okay let's save it ctrl s now uh if we refresh now you will see same image multiple time because we didn't write anything in the image source so let me just refresh and let's see how it looks so here you can see we can we are seeing same image again and again and we have the different name here name uh then you can see the speciality here if you go right you can see some more details so now let's add the image so let's go back to our code again and here you can see my source is equal to something is written and in the previous tutorial if you go to our admin controller and if you go down you can see that we saved our image inside doctor image folder in the public folder so let me just show you uh the public folder is over here and if you go to our doctor image you can see a lot of image over here so we are going to show all those images uh in the doctor dot plate dot php so for it we not we just need to say doctor image which is our folder name then we'll give slash then we'll give two second bracket and inside it we are going to say this doctors uh doctors then this arrow sign will say image now this image name is coming from the database here you can see image so let's save it ctrl s now let me just refresh here if we refresh it you can see the doctor images over here so all the doctor images height and width is seems to be different so let me just fix their height only so let's go back to our code and here inside the image will say height uh let's say it will be 400 px ah no let's say uh 300 px i think that will look better save it and let's refresh okay this looks a little better than before so right now if we try to log in uh we will get a error let me just show you let's go to our user then on two three four the password if you click login uh you can see um he wrote that dollar dot or not found because if we go to our home controller uh here you can see at the redirect function we are also returning user.homeview and in the uh user.home view you can see that we have this dollar doctor function and we write this dollar doctor only for the index so let me just copy this ctrl c and i'll paste it uh inside this if condition i will say this and and after this again we just need to say over here comma then we say compact and inside it we just need to say doctor so if we save it and if we refresh we will not see any error so here you can see uh currently we are logged in and there is no error we can see all the images perfectly okay their size changes again okay we will fix it fix it later like maybe in the last tutorial but before that there is a issue issue that i forgot to solve uh in the previous tutorial so let me just show you the issue first so if we go to our uh if we log into our admin dashboard and if you give the password and if you click login uh you can see uh these are admin dashboard and at the top if we just remove the url i mean the slash home i mean if we press enter it's taking us to this page which isn't correct so let me just solve this issue for it uh let's go back to our code and for it we need to go to our index because uh if we go to the route and then web.php you can see that the root view is actually this one is actually calling the index so we'll go to index and here we are just going to write a if condition a simple if condition we say auth then to double clone will say id so uh it means if there is any auth id then return redirect then it will call home so it will return the view to home slash home and if uh there is not id then we go to else condition and that is this one okay so else condition do not require any second bracket but let's just give it because it's better so let's save it now and let me just log out from here and let's log into our admin dashboard again let's say admin and let's see the password and let's see login so here again this is our admin dashboard now let's remove the slash home and let's press enter so it's still keeping us on the same page now in this tutorial we are going to let the user uh make their appointment from here now the logged in user and also uh the user that is not logged in both of them will be able to uh make an appointment so they will ask for the appointment and the admin will uh decide whether to accept or cancel the appointment so first of all we are going to just make some changes over here here you can see general health so instead of general health we will say the doctor name over here so that the uh user can choose that doctor from here so for it let's go back to our code and we'll directly go to users then we'll go to home.play.php and if you go down uh you can see that we inherited the appointment dot blade dot php over here so now we will go to our appointment.php and here you can see the phone name email address and the date and here you can see the department and the number and the message field so uh instead of department will have our doctor name over here and obviously we will not write them statically we will get the doctrine name from our database and if you go to our controller and then home controller.blade.php uh here you can see we already uh send the doctor details to our home page uh before so uh we are just going to mention it uh for this loop over here will say at the top for each then inside it will say dollar doctors as a dollar doctor as dollar doctors and this forage loop in will after this option so we'll say at the rate of in for each and inside this uh we'll say that doctrine name will give 2 second bracket then we'll say dollar dollar talk dot in this arrow sign then we'll say name so it will take uh show us the doctor name and also here in the value you can see in the value we will also paste the same thing will say dollar doctor name so if you save it and if you refresh now uh here you can see the doctrine name all the doctor name that we added over here you can see okay now let's also uh let's also show the doctor specially to over here as well so for it uh we'll just uh let me just copy this ctrl c and let me just uh give some gap over here then i'll paste it again and here we are going to say specialty s-p-e-c-i-a-l-t-y so if we save it and if we refresh now you can see the special tower here as well so you can just write it a little bit better way over here we can just say uh speciality is c i a l i t i speciality like this if we save it and if we refresh you can see it like this uh yeah i mean specialty skin shakil specialty heart john specialty heart joy specialty i so now the user will be able to see the doctor and doctor name and the specialty as well now let's also make it a little bit better let's add another option over here we're going to say option and inside it we are just going to say select doctor and save it control s and let's refresh okay you can see select dot now it looks a little bit better now if you want to upload those data to the database so we need to create a table first so let's go back to our uh command prompt and over here we are going to say php rt sun make then clone model unless our table name will be appointment i will p o int immune appointment and we'll give minus m then it will also create a migration so if you press enter you can see modulator successfully migration is also created so if you go to our code and if you go to app then models you can see appointment.php and if you go to our database then migrations here you can see appointment table over here so here we are going to add some uh new column so let me just say our hair let's say dollar dollar table then this arrow sign we are going to say string and first of all we will have the name username then let's say it will be nullable nullable and after this let me just copy this line control c and okay let me check how many field we have a four five okay total of six field uh over here so let me just on two three four five six okay after name will have the user email email then we'll have the user phone number after phone uh let's say we have the doctor you can say doctor name or anything i'll just go with the doctor and after this we'll have the date after date we'll have we'll have the message with the message okay now we will have one more extra field over here now uh okay now we'll say over here status sda status now uh normally the whenever uh user submitter request for appointment it will be uh in progress and the admin will decide whether to accept or cancel the apartment so and we'll have one more extra field which is uh let's say here user underscore id now this we are using this user id for the logged in user so i think everything is okay so let me save it and now we need to migrate this table so for it we need to say php rt sun migrate and if you press enter you can see migration is successful now let's go to our database and let's refresh so here you can see we have a new appointment field over here and all the column that we added now let's go back to our code and we go to appointment.blade.php and we'll directly go to over here you can see a form so we'll keep this class so after class we are going to say action and we say method and and we also need to add the uh csr field csrf to upload data so in the action okay let's write the method first method will be post since we want to upload to the database now in the action we are going to say url and inside it will say let's say let's suggest appointment and let's save it control s now we will go to web.php and create this url uh okay but before that let me just uh give the input field name over here let's say here name called to name now for email uh name equal to email and after email we'll have we have the date here so let's say nimiker to date and this is for the doctor right so let's say here select name is equal to doctor and and we have two more two more field on this number so let's name equal to number and here uh the message so here you can see name equal to message already so let's say we control s now we are going to go to our web.php to create this url so let's go to our route then we've got php and let me just copy this route ctrl c then ctrl v and here uh we'll say appointment w appointment and let's see our uh function name will be appointment as well wpo int mnt appointment and we'll use the home controller so let's save it ctrl s now we will go to our home controller and here we are going to create a function so we are going to say public then function then appointment and and inside this first bracket we are going to say request dollar request and let's skip to second bracket and inside it first of all we'll declare a variable let's say a dollar data you can declare any variable after this we need to mention our table name which is appointment appointment and since we want to use the appointment table so we need to add the apartment table model at the top so let me just copy this control c and control v and here we need to say appointment a double p o i n t m ent appointment now the model name always uh will be capital now let's go down and here we are just going to say dollar data this arrow sign now let me just go to our table and here you can see we have the name so we'll say here name which is for coming from the database then equal will say dollar request then this arrow sign and we want to request the name that we input over here so for it uh so this name will come from the apartment.blade.php and here you can see our name equal to name so let me just say over here name so let me just copy this and i'll paste it six times sorry eight time two three four four five six seven eight so after name we have let's say email and it will be email as well and we have after name email let's say that and now we'll have the phone in the database we write phone and in the web appointment.blade.php we write it the name as number after now this one will be left some message okay we have one more field which is the doctor doctor and we we we have actually uh two more field uh if we go to our database here you can see a status and user id so since the user uh applying for or requesting for the appointment so by default it will be in progress so i was over here status uh we don't have to give that request dollar request over here we will give to sync to single quotation and inside it we are just going to say in progress progress so and so the last one will call it uh user id so we say user underscore id equal it will be uh so user id equal uh we'll say here auth to double clone then we'll see the table name which is user then we'll say this arrow sign id so the thing is uh if the user is not logged in then it means the user do not have any auth id so this line will actually throw us a error so here we are just going to give the if condition if uh we'll say or double clone id then to flash bracket it means if the auth id exists only then count this okay so it means if the auth id exists only then uh it will store a id in this user id column so now we need to save it so it's a dollar data then this arrow sign we said save so let's save it now control s now let's go back to browser and let's just refresh okay let's keep the name let's say here name uh test let's say email will be test now this is for a user who is not logged in let's keep it date as well and let's say yeah here let's give a phone number random phone number and let's say test in the message so if you click submit request okay here you can see in the url slash appointment and now uh if you refresh over here in the database you can see that we have the name email phone number uh the doctor name which is yeah here then date the message status is in progress and we do not have any user id because this is a user that is not logged in now let me just fix it so after saving the data we want to stay on the same page so we say return then redirect and we'll say back so let me save it and let's refresh uh let me just remove it let's refresh and let's just uh write the name again let's say dvd just random random date doctor random random phone number and let's see enter a message just click submit request okay we are now on the same page now let's try to book an appointment for our logged in user so let's now login first and let's keep the user let's see the password click login okay we are now currently logged in so let's say here uh in the in the full name we'll select the user and let's give the email which is user and let's give a random date select a doctor let's give a phone number and let's say message something random let's click submit request okay now let's go back up now let's go to our database and let's check uh if it store the user id or not so let's refresh here so here you can see it stored the user id which is three now if we go to our users table you can see that users id is actually three so let me just explain it again uh here uh we are actually first checking if there is any auth id if means if there is any logged in if there is any user login only then it will execute this line of code otherwise it will not execute this line so let me just uh return a message so that user can understand that appointment uh request is successful so we'll say we then here we are going to say message and we're going to give a comma and here we are we'll just say appointment request successful full will contact with you soon we contract with you soon save it now uh we want to show the message let's say at the top over here probably so now we will go to our home.blade.php so let's go to our uh user then home.good.php and we'll add the message over here after this header part so we already did a message part in the previous tutorial on so let me just copy that portion of code from there so we will go to adddoctor.blade.php and actually over here you can see we added the success message over here so let me just copy this if condition from here to here control c and then we will go to home user home.play.php and we are going to paste it over here now here you can see let me just explain it again in the from the home controller we are actually sending the message which is this one and in the home.blade.php here you can see if it has any message now this message is actually this one so if there is any message then uh it will show the message and this if condition end over here so let's save it and let me just refresh again and let me just uh add a user let's say user again and with the email address which is user at the top gmail.com let's see the password select a doctor receive the number and let's see the message if you click submit request you can see appointment or request successful will contact with you soon and there is also a close button over here now in this tutorial i am going to make a my appointment option over here and only and this option will be only available to the logged in user so if a user is logged in only they will see the my appointment option over here so let's go back to our code and we'll directly go to our resource then views and inside views we have users and inside users we have home.plate.php and if we go down uh you can see over here we give a if condition if there is any auth then we will count this on now now this line is responsible for uh to show us the log out option for user and if there is no auth it means there is no user is logged in then it will show us login and register so what we are going to do is that we are going to add a li over here so let me just copy this li ctrl c and i will paste it over here control v so here you can see contact so instead of contact we are going to say my appointment appointment so if you save it now and if we refresh you you won't see any my appointment option over here because currently we are not logged in and it will show us this my apartment text only when there is a login so let's login first let's click login we'll go to user then password login and here you can see currently we are logged in and we have been my appointment text over here and the logout option so let's just change its design a little bit so for it let's go back to our code and here uh inside this anchor tag we are going to add a style let's say style let's say background color uh let's say it will be green yellow so if you save it and if you refresh here you can see its background color is changed now let's uh make this uh text color white i think that will look better so let me just see over here color uh equal to white ctrl s now let's refresh okay i think it looks better right now now what we are going to do is that if someone click this my apartment option then it will take the user to another page where they can see their apartment so for it let's go back to our code again and here you can see inside the hdf we are going to mention a url and we are going to say uh two second bracket and we will say url now here in this url uh we are going to say my appointment a double p o i n t m e n t appointments so let's save it control s now we will go to our web.php and create this url so let's go to route then web.php and here i'm just going to copy this route control c and it will be a get request so it's a get and let me just copy this url ctrl c and i'll paste it over here control v and let's see our class name it will be the same thing my appointments so let's save it ctrl s now we'll go to our home controller and create this uh function so let's go to our app then http then controllers then home controller and we'll directly go down and here and here we are just going to say public function then uh my appointment then two first bracket two second bracket and from here we are just going to return a view return view uh we are going to say user dot uh let's say my underscore appointment a double p so uh we do not have this my appointment.php so we are going to create this uh blade file inside our user folder so let's go to our user folder then right click on it then new file and here we are going to say my underscore appointment dot play dot php so let's save it ctrl s then save and here we are just going to say something simple let's just say html and inside body we are going to say h on and let's say show appointment let's save it ctrl s now let's refresh and now if we click my appointment here you can see it is showing us this show appointment so here we need to add a navbar just like our home page uh if you go to our home page you can see a navbar over here so we are going to add this to our uh my appointment page so for it uh let's go back to our code and we will go to home.blade.php and we are going to copy the code for the nav fir so let me just copy first everything from here control a control c and i'll paste it inside my myappointment.blade.php so ctrl v over here and let me just remove the unnecessary things we will only keep the navbar and we are going to remove everything else so let's remove it after the end of this header part here you can see login description so let me just remove it from here too okay we'll only keep the script part so let's remove it so let's save it ctrl s now if we refresh here you can see the uh never part over here now here we are just going to create a table to show the appointment that the user make uh so for it we are first going to create a table over here so we are just going to say here let's just uh have our table inside a div so inside this tip we will say table and a table has a header part and and the data part so first of all we are going to say tr and inside this tr we are going to say t h t h means table header so let me just copy this th ctrl c and i am going to paste it three times so ctrl v two three so uh inside this uh let me just show you our table and inside the table header will have the doctor name then date then the message and the status so over here we are going to say doctor name and here we are going to say day after date we will have the message and the last one will be status so let's save it and now let's create another tr and we'll have some td table data so we'll have four td since we have four table header ctrl c three four so let's save it and if we refresh now over here you can see that table uh like this now we need to change its design so for it let's go back to our code again now here you can see that uh we have our table inside this tip so we are going to say over here uh let's say align we want the table to be centered let's say center and let's also add a style let's say it will be padding uh let's say padding will be 70px and if we save it now and if we refresh over here you can see it's now in the middle now let's add some more uh design over here as well now inside this tr let's add a style let's say background color it will be black and let's also add some style for the table header as well so let me just select everywhere every th and we say over here style and inside this style will say padding it will be 10px and after padding let's say we'll also have font size font size it will be let's say 20px and let's also add a color for them text color let's say text color it will be white so if we save it so if we save it ctrl s and if we refresh here you can see it looks like this and it looks better way better than before so now let's go back to our homecontroller.blade.php and from here we're going to send the specific apartment that is made by this specific user but before that let me just fix something uh if we just log out from here click log out if you just say in the url if it's just a slash my apartment and if we press enter it is still taking us to this page when the user is not logged in so this isn't correct so i will only show this page uh when the user is logged in so for it we'll just say in this my appointment function we are just going to give a if condition if or id if auth id exists only then show this view control x and control v and if there is no auth id then uh we'll go to else condition where we'll say return redirect and return redirect back it means stay on the same page save it now and let's refresh now let's say if you want to save our hair slash my appointment and if we press enter it's uh keeping us on the same page so this is more logical now let's go back to code again so here uh after login we want to show the user their specific appointment that is made by them so for it we first need to get the user id that is logged in so let me just first declare a variable let's say user id is equal to auth then double clone will say user then to file bracket this arrow sign id so we'll have the uh user id stored in this user id variable so if you go to our browser uh and go to our database here you can see in the appointment we have a user id field when a logged in user is booking a appointment uh it also showing that id and if you go to our user table uh you can see that that id over here as well so using this we are going to show the specific appointment is made by the specific user so for it uh first of all we need to write a higher condition over here so let's just first declare a variable over here let's just say dollar dollar a point a point is equal to uh now we are going to say our table name which was appointment then we will give to double clone and here we are going to uh write a higher higher condition and inside it uh we give two single quotation and here we need to write this if you go to our database you can see user underscore id so we'll write here user underscore id comma we'll write this variable user id dollar user id so uh and then the last will say get so it means uh if the if the user id in the table and this user id matches then then only it will uh get that specific uh apartment for that specific user so here we are just going to say comma compact and we will send this appointment we say appoint a point not appointment we'll say this variable a point so let's save it now we'll go to our my appointment.blade.php and here you can see some td and this tr and we are going to add a foreign loop before this tr we are going to say at the rate of for each dollar a point a point as let's say a points happens and this polish loop will end after this tr will say at the rate of end for each and inside this tt we are going to say give two second bracket and we are going to say appoint a points which is this one oh sorry it will be dollar appoints equal dollar appoints then we'll give arrow sign and first we'll say that let me just check the database first we have the doctor date message and status so first one will be doctor let me just copy this control c ctrl v now this one will be dead after date we have the message and the status so let's say here message and here status status so if we save it now and if we refresh over here okay sorry we first need to login so let's go to our user then give the password click login now here you can see my appointments now if you click this it's showing us the doctor name the date message and the status now the admin will decide what will be the status if the admin accept uh this appointment then it will show over here that accepted or something else so let's just add some design for showing the data as well so for it let's go back to browser again and let's say we'll use the same style that we did for the table header so let me just select every td then ctrl v and let's say their font size will be different so let's remove those font size okay now let's save it and let's also add the background color over here as well uh let's see our hairstyle inside this uh tr uh let's say the background color will be black uh because the text color is white and if the background color is not black then it will show us nothing so if we refresh now so here you can see the doctor name date message and the status here so now let's also add another field called uh like cancel appointment so that uh the user can cancel the appointment by their own if they want so for it let's go back to our browser and here we are going to add another th so let me just copy this ctrl c and ctrl v and here we are going to say uh let's say cancel appointment so if we save it now and if we refresh here we can see we have on extra field called canson appointment so for it so let's go back to code again and here let me just give a td over here after this status will say td and inside the studio will give anchor tag and it will be let's say we say over here cancel and let's also add a bootstrap class inside this anchor tag uh we're going to say btn btn uh delete sorry begin between danger and if you save it and if you refresh you can see a button over here like this okay now we should have the uh table data in the middle that will actually look better so here we are just going to say align center inside this tr save it and refresh okay now this looks better now if someone click this uh cancel button then it will automatically delete the appointment so inside this hdf we are going to add another url so we will say url and inside two single quotation will and inside this url we are going to say cancel appoint let's just say underscore a point so let's save it ctrl s now we'll go to our web.php again and let me just copy this route ctrl c ctrl v it will be get request and let me just copy this cancel a point copy ctrl c ctrl v over here and let's see our function name will be cancel underscore appoint as well so let's save it now let's go to our home controller again and we are going to say public function public function uh cancel avoid another thing is uh there is a multiple appoint a point option over here now the user may uh want to delete a specific appointment so uh we'll go to our my appointment again and here we're going to send the id uh with this url so we'll give a dollar a point we are going to say a double poi appoints then this arrow sign will say id so it will also send the id with this url to the web.php and we'll give a slash over here and we'll give two second bracket we'll say here id and this id will be cached by the cancel appointment function in the home controller so we'll say here troller id and here we're going to declare a variable let's say dollar let's say dollar data is equal to uh we'll see our table name which is appointment and we'll give 2c then we'll say find and inside it we are going to save dollar id and then we will just say dollar data this arrow sign delete after this we want to stay on the same page after deleting it so we'll say return then redirect back back so let's save it ctrl s now just let's just refresh over here so if we click this cancel button okay the data is deleted now user may accidentally click this cancel button so we should uh so if the user click this cancel button we should show something that uh saying that are you sure or something like this so for it let's go back to our code again now we will try to go to our myappointment.blade.php and here inside this anchor tag we're going to say on click then equal uh will say return confirm and inside this first bracket we are going uh we will give to single quotation and we will say are you sure to delete this so let's save it control s and let's just refresh again and if you click cancel it is showing us a message that are you sure to delete this and if you cancel click cancel it will not delete it and if you click ok it will delete the appointment so there you go so this is all for this tutorial in the previous tutorial we let the user see their appointments and user is also able to cancel their appointments now in this tutorial we are going to let the admin uh change the status of the apartments here you can see in progress admin can change the status to cancel or approve so now let's just log out from here and let me just log into the admin dashboard click login and we'll give the admin username i'm in the email and the password click login so here you can see this is the admin dashboard now first of all we are going to have a uh appointment sidebar over here so that uh when the admin click the appointments it shows all the appointments so for it let's go back to our code and we will directly go to our resource views then admin and here inside admin we have the sidebar.blade.php and if you go down here you can see add doctor option over here so we are just going to copy this li ctrl c and we are going to paste it over here and we are going to say here appointments appoints main and and if we save it now and if we just refresh here you can see a new uh sidebar option over here appointments now if we click appointments uh we'll see a new page where we can see all the apartments so let's go back to code again and here you can see inside hdf there is a url so we are going to remove this url now inside this url uh let's say we will say show appointment so let's save it ctrl s now we we need to create this url so we'll go to route then web.php and let me just copy one of the route ctrl c then ctrl v and here uh let me just copy this show appointment ctrl c and we'll paste it over here and let's say our function name will be same thing show appointments and we'll use admin controller since we are in admin so now let's save it now we will go to our admin controller and create this function so let's go to our admin controller app then http controllers admin controller and here we'll just say public function show appointment then to first bracket and we are just going to say we are just first written a view return view and inside it i will say admin dot always show appointment and let's save it control s now we do not have this show appointment blade in the admin folder so we need to create it so let's go to admin folder right click on it then click new file so we are going to save our hair show appointment dot blade dot php so control s now save so here you can see show up on paint dot blade dot php now in this show abatement let's just say html and in and inside this body we are just going to say h on let's just say test view and if we save it now and if we refresh and if we click the appointments here we can see test view so we are going to copy some code uh in this view so let me go to our home.php and over here i am going to copy everything ctrl a ctrl c and will paste it inside show appointment.play.php so ctrl v now we are going to remove this uh admin dot body so if we save it and if we now refresh here you can see here uh a view without the body so now we are going to uh show a table over here that it shows all the appointment that the user make so let's go back to our code again and here just like uh in the previous tutorial that we did uh for the add doctor.blade.php uh we need to add this uh d class ctrl c and we need to add this step class after this navbar because if we don't add this div class then we won't be able to see any design we make uh let me just show you uh if we just write over here h on and we just say some random things save it and if we refresh we won't see anything over here but if we just cut it from here and we if we have it inside this tip and save it and refresh we'll be able to see it here you can see h now this is for because uh we are using a template and now this template use certain class for showing things in the body part so here we are going to first of all create a table so for creating a table uh let's say over here let's just create a div and inside this tip we are going to have a table so let's see our table and it will obviously have a header part and body part so first of all let's declare the header part ph and let me just copy this th and we'll paste it seven times on two three six and seven and now in this stage we are going to write uh all those things uh all the column that we have in the appointment table you can see name email phone doctrine name then the date message and the status so here we are just going to say first uh let's just say the customer name customer name and let's have the cust uh customer email then we'll have the customer phone number and after this we'll have the doctor name doctor name and we'll have the date then the message that the customer give message and the last one will be status so let me just save it control s and if we just refresh here you can see it like this now let's just change that design a little bit now uh here you can see this now inside this div uh let's see here align it will be center and let's also mention a style over here we say style let's say padding it will be 100 px so let's save it ctrl s and let me just refresh okay this looks like this now let's change a little bit now now in this tier we are going to mention a style and inside this style will say background color uh let's say it will be black and if we save it now and if we refresh here you can see it looks like this now let me change a little bit more in this th we are going to say style and we will just say padding it will be 10px so let me just copy this style ctrl c and let me select every page over here and we are going to just paste the style control s and if we refresh now okay this looks better than before now let me make some design for table data so we'll give another tr and inside this tr we'll write td td means table data and we'll obviously paste it seven uh sixth time just like we did for the table header okay now let's just uh say random things inside the td ss save it and let's refresh so this is how it looks now let's also change the design a little bit as well inside this tr we are going to say align it will be center and let's also uh say style and let's also say background color it will be let's say background color will be uh sky blue now if we save it and if we refresh here you can see that background color is sky blue and that text is also in the center so now let's show all the data that we have in this appointment table so for it uh we need to go to our admin controller dot php and here uh first of all we need to get the all the appointment data so we say here dollar data you can declare any variable dollar data is equal to uh we need to say our table name which is appointment double clone all so it will get all the data from the appointment table and since we are also using this appointment table so we also need to add the appointment table model at the top so let me just copy this ctrl v and if you go to our app the models here you can see appointment so we need to just say over here appointment so now let's say we control s now we need to send this uh data to our view so here we need to say compact and inside it we just need to say data so it means we are actually sending all the data to our uh this view so now let's go to our show appointment and here let me just remove all the double s okay now we will write a foreign loop before this tr for the table data so we are going to say over here for e uh let's say dollar data as dollar let's say a point and this forage loop will in after this tr so we'll say here at the rate of int for each so now uh in this td let's keep two second bracket and inside the second bracket here you can see we set all our appoint so let me just copy paste it and now we'll give arrow sign and now uh the first one is the customer name so here if you go to our database here you can see customer name we write as name so here we are just going to say name and let me just copy it ctrl c and i'll paste it it uh paste this inside fbtt so control v now after name we have email phone doctor name date message and status so let me just uh write everything so we say our email and here we are going to say a phone after this we have the doctor name so you say doctor then date then the message and the last one is status so let's save it ctrl s now if we refresh over here you can see the customer name the customer email phone number then the doctor name the date the test and the status and every status is in progress so there is a total of three data and let me just check in the database okay a total of three data so after this status we'll have two more uh column over here one will be approved and another one will be uh canceled so let's go back to our code again and here uh let me just copy this status ctrl c and i'll paste it two times so this one will be approved and and the second one will be cancelled so let's go down and let me just write here 2td td and we'll declare another td over here and inside this td we are going to mention anchor tag or let me just write it properly now inside this anchor tag we are just going to say approve and for the second on uh let's just keep the anchor tag first and for this anchor tag uh this one will be for cancelled so let's also mention a bootstrap class over here so let's say class is equal to btn btn uh minus success and the second one uh this one will be class uh let's say btn btn minus danger so let's save it control s and if we refresh now here you can see approve and cancel option over here now here you can see that our table is a bit on the right side so let me just change the design a little bit here you can see in the uh division we write padding 100 so here we are just going to say padding top hundred so if we save it now control s and if we refresh so here you can see this right now looks better so now what we are going to do is that if the admin click approve then it will be uh if status will change to approve and if the admin click cancel then its status will change to cancel so for it again we will go to our code and we directly go to the anchor tag here you can see approve and inside this hdf we will give two second bracket then we'll say url and inside this url we are going to say let's say approve now we also need to send a specific data so we'll see our hair comma dollar appoint then this arrow sign will say id so what will happen is that if someone can't click this app button then it will take this id if someone click this approve button then it will take the id for this appointment so let's go back and here so now we'll go to our web.php and let me just copy this on ctrl c and ctrl v and here we are just going to say approve approve then slash id and we use admin controller and here let's our function name will be approved as well so now let's go to our admin controller and here we are going to say public function approve and inside this we need to mention the dollar id and after this we need to declare variable it's a dollar data equal now we need to save our table name which is appointment then we'll give to double clone and we say find find id find dollar id so it will uh find the basic appointment with the specific id so let me just explain it again if someone let's uh click this approve approve button then it will uh get the specific id for this so if you go to our database you can see that in the uh appointment table uh this appointment specified is five so it will get the specific id and change it status here you can see status and we only want to uh on to change the status so it's in progress so we are going to say dollar tata we are going to mention the status equal we will say uh choosing inside the single quotation we will just say approved approved and and after this we are just going to say dollar data this arrow sign save and we also want to stay on the same page so we say return redirect and we'll say back return redirect back so let's save it ctrl s now we'll go to our browser and let me just refresh over here if i click the approve button here you can see that uh this status is changed to approve now if i just click also click approve for this one here you can see it step status change to approved now let's also do the cancel part as well so let's go back to our code again and cancel part is also the same uh just like the approve so we'll just say over here inside this url uh href we are going to say url and then uh let's say here cancel and we also need to mention that dollar appointment id over here a point id here so now let's save it now we will go to our web.php and let me just copy this route ctrl c and ctrl v and we are going to see over here cancelled so let me just copy this one cancel ctrl c and i'll just paste it over here and here as well ctrl v ctrl s since both of them is basically the same so now again we'll go to admin controller and and let me just copy this function public function control c and we'll say control v and we'll change the function name which was canceled so let me say cancel so just like before we are getting the id then we are finding the specific id in the table and here we want to change the status from approve to cancel cancelled uh so let's say we ctrl s now let's just refresh over here so here you can see uh this one is approved now uh if we click cancel you can see that its status change to cancel now if you click also here cancel here you can see its data changed to cancel now uh here you can see that the status is approved now if we just go to our uh user page let me just log into our user so let's log out and let's go to our user which was which i just created a new user uh this one then let's give the password let's click login so if i go to my appointments so here you can see that my status is approved over here as well so in this tutorial we are going to show all the doctor in this admin panel now you can already see that we already have the option for add doctor so we are going to have another sidebar over here and and if we click that sidebar it will show us all the doctor so let's go back to our code and we'll directly go to our resource then views and inside views we have the admin and inside admin we have sidebar.blade.php so inside it will just directly go down and here we are going to copy this li control c list and we are going to paste it over here ctrl v and here we are going to say all doctor so let's save it ctrl s so now if we go to our browser and if we refresh here you can see we have another option called all doctor so when we click on doctor it should show us all the doctor so let's go back to our code and we'll go to and here you can see uh href over here so let's say over here show doctor doctor so let's save it control s now we will create this show doctor url so we'll go to route then web.php and over here uh let me just copy this one this route ctrl c ctrl v and over here we are just going to say show doctor and let's say the function name will be show doctor as well and we use the admin controller so let me just uh save it ctrl s now we'll go to our controller then admin controller and here we're going to write the function show doctor so we'll say public function show doctor and here we're just going to first return a view so we'll say return view and inside it will say admin dot let's say show doctor so we do not have the show doctor blade so we need to create it inside admin folder so let's go to our admin folder then right click then click new file and here we are going to say show doctor dot blade dot php so ctrl s and say so let me just uh write something simple over here so inside this so inside this body we are just going to say h on and let's say here show so let's save it ctrl s and let's refresh and if we click show doctor you can see that it show us show so let me go back to our code and here we are going to copy some code and we will directly go to our home.blade.php so we are going to copy everything from here control a control c and we will paste it inside the showdoctor.control v and let me just remove this admin dot body so if we now save it and if we refresh here you can see uh at the url you can see show doctor and there is nothing in the body so we are going to create a table over here so that we can show all the doctor so let's go back to our code and and this time we will go to our show appointment.blade.php and here and from here we are going to copy this div so ctrl c and we'll paste it over here inside this after the navbar so ctrl v let me just in this div now let me just copy a little bit more from the show apartment let me also copy this div align center style padding top 100 px and we'll paste it inside this div and let me also close the div and now uh inside this div we are going to copy one more thing which is this table tr so let me just copy it ctrl c and ctrl v so over here you can see uh inside tr i'm in the table row we have some table header so here we're going to have our doctor details so if we go to our database and if we go to our doctor table uh here you can see a doctor has name phone number specialty room and the image so a total of five uh five columns so let me just write them in our code so first of all we are going to say here doctor name and the second one will be phone then speciality after that we will have the room number for the doctor seat so and the last one will be doctor image so we do not uh record the rest of the parts so let me just remove them and if you just refresh over here you can see the doctor name phone speciality and room number uh like this over here so now we'll go back to our code again and now this time uh we'll now directly go to our admin controller and since we want to show all the doctor from the database so we need to send the doctors data from our controller uh using this function so first of all we'll declare variable with the dollar data is equal to we'll say doctor which is our table name then double clone all so it will get all the doctor's data and store it in this uh dollar data variable and then we are just going to say comma compact and inside it will say data so if we save it okay one more thing since we are using this uh doctor table so we also need to add the doctor model at the top and we already add the model doctor model before so now we will go to our showdoctor.blade.php so let's go to a showdoctor.blade.php and here you can see this tr is for the table heading and for table data we need to write another tr so let me just write tr and inside this tr will have the table data so let me just say td and let me just copy it and i'll paste it five times on two three four and five so in inside this tv first of all uh we need to show the doctrine name but uh before that let me just start a for this loop over here we'll say at the top for each and first bracket and we'll say dollar data as let's say dollar doctor and this forage loop will end after this tier so we'll say at the rate of in for it and inside this td will give two second bracket and here we need to say this variable which is dollar doctor then this arrow sign and we need to say name so let me just copy this doctrine name and i'll paste it over here so after name we have the phone number specialty uh room number and image so here we say phone and let me just check the spelling specialty in the database okay s p e c i a l t y and uh this one will be room so if we save it and if we refresh now here you can see the doctor details over here and we do not write the code for the image but before we add image let me just change the design a little bit and let me just go to show apartment again and here you can see that in the td we write this style so let me just copy it ctrl c and i'll paste it inside this tr so ctrl v and if we save it and now if we refresh you can see the background color is sky blue and the text is in the center so let's now add the image so if we go to our admin controller and let me just show you that here you can see that we upload the doctor data from this upload function and here you can see we stored the doctor image in this doctor image folder which is inside public folder so if you go to our public folder you will be able to see doctor image over here and here inside it we have a lot of image so for showing the doctor image we first of all need to declare image tag inside the td and inside this source we need to say doctor image then slash then we need to give two second bracket and then let me just copy this dollar doctor room and i'll paste it over here and here instead of room we'll say image so you'll get the specific image in the doctor image folder so if you save it and if we refresh now here you can see the doctor image over here now let me just uh resize their image length so for it uh we'll say inside this image we'll say height let's say height will be 100 and let's say width it will be 100 so let's save it and let's refresh so there you go we can see the image for the doctor now we add two more uh column over here one will be to delete the doctor data and another on will be for updating their data so for it let's go back to our code again and here and here i'm going to copy this th so ctrl c and i'll paste it two times ctrl v and ctrl v so here i'm going to say delete and after this we'll say update so if we save it now and if we refresh here you can here you can see two more column delete and update so let's go back to our code and this time we'll add two more td over here so let's say here td and here inside this td we will declare anchor tag and here we are going to say inside this anchor tag we'll say let's say delete and we'll also mention a bootstrap class here and it will be btn ptn danger so after this uh let me just copy it and paste it over here and this time we'll set instead of delete we'll say update and here instead of denser let's say primary so let's save it and if we refresh now here we can see two more button over here one is for delete and another on is for update so let me show uh do the delete part first so let's go back to code and here inside this hdf we are going to give two second bracket and then we are going to say url to first bracket to single quotation and let's say delete doctor and we need to say her dollar doctor id so dollar doctor this arrow id so let me just explain it uh so if someone click this delete button then it will get the id for this data and then delete this data so we are actually sending this id to our route so for it now let's go to our route and create this url we will go to web.php and let me just copy this one this route ctrl c ctrl v and here we are going to say delete delete doctor id and let's say our function name will be same delete doctor so now let's save it ctrl s and now we'll go to our admin controller let me just go down and here we are going to say public function delete doctor and here uh we need to set dollar id so let me just explain it again uh we are sending the specific id to our web.php here you can see the id and our route is sending this id to our admin controller delay doctor function so here we are going to declare a variable with a dollar data is equal to our table name which is dr double clone and we'll say find and inside this find we'll say dollar dollar id and now in order to delete it delete that specific data we just need to say dollar data this arrow sign delete so right now we are just going to say return redirect and to first bracket this arrow sign back so after deleting the data will stay on the same page so let me just save it ctrl s and if we refresh now and let me just delete this one if you click delete it will delete this doctor image doctor data here you can see that doctor is gone now the admin may accidentally click the uh delete button so whenever the doctor click this delete button uh we'll show a message that are you sure so for it uh let's go back to code again and we'll go to our showdoctor.blade.php and here inside this anchor tag we are going to say on click on click then uh we are going to say return confirm and inside it uh we give two first bracket and inside it we are just going to say are you sure to delete this so if so if we save it now and if we just refresh here and if we click the delete button here you can see a message are you sure to delete this and if you click ok it will delete the data and if you click cancel it will not delete the data so let me just show you uh let's click delete then let's click ok so here you can see that the last data is gone now in this tutorial i'm going to show you how we can update a specific doctor data over here so what will happen is someone click the update button then it will take us to another page with the certain doctor data and we'll be able to edit there or update the data so first of all let's go back to our code and we'll directly go to our views then admin then show doctor.blade.php and if we go down you can see that you can see that inside this td we have the update button so inside this href we are going to mention a url we are going to say let's say update doctor and we also need to send a doctor id form here but we'll do it later so that i can explain it uh to you more easily so let's just first create the update view so now we'll go to our uh routes then web.php and let me just copy this route control c and control v so our url name will be update doctor update doctor and let's see our function name will be update doctor as well and we'll use the admin controller for this so let's save it now we need to go to our admin controller so we'll go to http controllers admin controller so here we are going to create the function update doctor so we say public function update doctor and here we are just going to return a view first so we say return view and inside it will say admin dot let's say our psn will be update underscore doctor and now we'll go to our admin folder and create this update doctor blade so let's go to our admin folder and right click on it then new file and here we'll say update underscore doctor dot play dot php so control s and save so right now let me just uh say something simple over here and inside this body will say h on and let's say update page save it and let's now just refresh here now if we click this update button it will take us to another page and it says update page so now uh we are going to copy some code from our home.blade.php and here you can see let me just copy everything ctrl a ctrl c and we'll paste it inside update doctor dot blade dot php so ctrl v and let me just remove this add pin dot body part and if we save it now and if we just refresh over here and if we click the update button now here you can see at the top we have the url update doctor over here so the thing is uh whenever the user click this uh update button it should take us to the page with this doctor data right so what we are going to do is that uh we will go to our showdoctor.break.php and here inside this href we are going to mention the doctor id just like before we did for the delete so let me just give our hair comma and we will say drop dollar doctor then this arrow sign id so we will save it now we'll go to our web.php and we need to catch this id so we'll go to web.php and here we are just going to give a slash then we'll say here id and we are sending this id to our admin controller update doctor function so let's go to admin controller then update doctor function here you can see so we'll say here dollar id and after this we need to declare variable will say dollar let's say data is equal to you can declare any variable you want now we need to say our table name which is doctor tower clone find and to file bracket inside it we need to say dollar id so uh what will happen is that uh if someone click this update button then then our this url will get the specific id send it to our web.php and our web.php will send it to our admin controller over here and using this dollar data variable here you can see dollar data find id it means it will search the specific id in our database and then store that specific data in this dollar data variable so we need to send this dollar data to our view so we will say compact and inside to first bracket we are going to say data so let's save it so now we are actually sending the specific doctor data to our this update doctor view so now we will go to our update doctor.blade.php and let me just copy a d from showdoctor.blade.org so let me just copy this control c and i'll paste over here and i will in this steve and here let me just show you the database first if you go to our database and if you go to our doctor table so here you can see all the doctors name phone specialty room and image so we want to show all those data at the update page so for it uh let me just show you the basic now we are sending the dollar data from here so if we just say over here to second bracket and inside it if we just say dollar data and if we just say name and and after them let's just uh let's just check we have phone specialty room okay so let me just copy this one control c control v okay let's just say uh over here phone and let's see here room and and if we save it and if we refresh now over here so if we click it it will get the specific id of this data and show its data to other page so if you click update okay for some reason the css is missing it cannot find the public folder but at that down you can see the name phone number and the room number as well so let me just fix this first so if you go to our uh update doctor.blade.php and at the top we are just going to say inside the head we are going to say base and inside this h step we need to give slash public now if you miss the slash it on ork so if we save it and if we refresh now everything should be fine okay so here you can see the doctor name then the doctor phone number and the doctor room number let me just check it for another one if we click uh this one here you can see different name different phone number and different room number so obviously we cannot show it like this we need to show it in a proper way now if you go to our add doctor you can see a design like this so we are going to create a same design for our update doctor page so for it uh let's go back to our code again and here let me just remove this uh this part and here let me uh we'll declare a div and inside this tip let's just say class equal to container and it will be align center center and let's also add the style it will be padding 100px so inside this we need to declare a form or create a form and we will now say another div and inside this tip will have a level and let's say it will be doctor name and a input field for doctor name so we say input so input type will be text and name is equal to let's say name only and it will have a value and what will be the value value will be this one dollar data name just like before uh we showed a doctor name and let me just copy this on ctrl c and i'll paste it uh four times on two three and four so after name we have our doctor phone number let's just say only phone and here the type will be number and here the value will be phone and after phone uh we have the doctor specialty speciality and type will be text and dollar data specialty and after this we have the doctor room number let's just say room and here the type will be let's say text that's okay and dollar data room so if you save it now and let me just uh click this stock this doctor smith here you can see doctor name is mean so if you click it okay you can see the doctor name but the text color is white actually that's why we are unable to see it so let me just change the text color for them so let me just say inside this input field uh let's just say a style and we'll say color it will be black so now let me just copy this on style control c and i'll paste it inside every input field so now ctrl v and if we save it and if we refresh here you can see the doctor name phone number perfectly now this one will be actually doctor emails so we'll do it later but let me just fix their style first uh we'll go to our here you can see we declare it if now inside this tip will declare a style and we say padding it will be 15 px and let me also copy this one ctrl c and i'll paste it inside everyday ctrl v ctrl s and if we refresh now we will see some gap over here so you can see that it created some gap now we need to like align them a little bit so for it uh let me just go directly at the top inside this head we are going to mention a style here we'll say style and let's say here level and inside this level let's say display uh it will be inline block and we'll also say width it will be 200 px so if we save it now and if we refresh you will see the level in different position you can see that so now we have another on which is uh this one it will be doctor image actually so let's go back to our code and we directly go down and let's say here instead of doctor name we'll say old image so we'll show the old image so in order to show image we need to use image stack not input type so we say image now here we need to mention the image source now we saved our image all the doctor image inside this doctor image folder so we are going to say here doctor image then slash and we will give two second bracket and inside it will say dollar data arrow sign image so let me just explain this a little bit if you go to our database you can see a lot of image over here so it will get the specific image and it will search for the specific image inside this folder and then show it so let me also just mention the height and width let's say height will be 150 and width will be on 50 so save it and let's refresh here so here you can see the old image so now we will have another option to change the image so for it let's go back to code and and let me just mention a div over here another div and inside it will say at the level it will be change image and will have a input type this time the input type will be file and we also need to mention the name let's say name we call to file as well and let's also let me just copy this style ctrl c ctrl v and we also require a submit button so let me just copy this div and here we are just going to say input type it will be submit and it do not submit button do not require any name so we'll say here a class bootstrap class will say btn btn btn btn let's say primary so save it and if we refresh now here you can see the old image and a change image option and a submit button so now let's go back to our code and we will directly go to our here you can see from our form started from here so we need to mention the action then the method and we also need to say here enc type since we want to send file so we will say multipart slash form minus data and we also need to mention the at the right of csrf so the method will be post uh since we want to update the data so and the action we need to mention the action so let's say url here url and we'll say and let's say here just edit doctor and we'll give a comma and we'll mention the dollar data id dollar data id uh so now let's save it and now we'll go to our or route and create this url so let's go to our web.php and let me just copy this on ctrl c and ctrl v here we are going to say edit doctor and our function name will be edit doctor and we are also sending the id so now let's go to our admin controller and let me just say here public function edit doctor then we are going to mention the id so it's a dollar id and first of all we need to declare variable let's say here doctor we need to get the specific doctor over here so it's a dollar doctor then find then we'll say dollar id so we'll find the specific doctor and after that here you can see that uh we are sending the emails and a lot of other data so for it uh we need to also mention the request over here so we say request dollar request then comma dollar id so here let me just first of all get all the data like doctor name and phone number so for it we just need to say dollar doctor this arrow sign then let me just show you the database here you can see uh we have the name phone speciality room and image so over here we need to say the name that we have in the database and then we need to say here request this request then arrow sign and this request is actually this one and we are actually requesting the data from our update doctor blade and here uh you can see that the name is also name so we are going to say name and after name we have the doctor phone number then then specialty and then the image so let me just write all of them for okay so let's say here phone number let's say phone and after phone we have the doctor specialty and after specialty we have the room number and let's just say here room and let me just save it and i did not give the name for a phone specialty and room in the update doctor view so let me just change their name here you can see name so this one is for phone we say phone and this one is for specialty sp e c i a lty and then we have the room so let's say name equal to room now for image we need to do it a little differently so let me just here declare variable let's set all our image equal to we say dollar request this arrow sign file so uh we are actually requesting the file from our update doctor.blade.php here you can see name is equal to file so that file is now inside this image variable now here we are going to declare another variable let's say here dollar image name image name is equal to uh time to first bracket then we'll give a dot then we'll give two single quotation and inside this we need to give another dot and after them we need to give another dot now we need to declare this uh mention this dollar image over here so we will say dollar image this arrow sign and we need to say get then uh capital o or e z null client capital c cli client extension capital e extension so let me just uh explain this line a little bit uh that is we are first of all getting the image and we are actually changing that image name using a time function so every image in the database will have a unique name so after this we will say let me just copy this ctrl c and we'll say dollar request file then this arrow sign move to first bracket and inside it will we need to give the folder name which was a doctor image so let me just say doctor image and we need to give a comma and at last we need to say this dollar image name so let me just copy it and paste it so what will happen is that the requested file will be moved to our doctor image folder and its name will be this one so and at the end we just need to say uh this variable dollar doctor so we say dollar doctor this arrow sign we need to say image now this image is form coming from the database obviously image variable so equal to we will just say dollar image name so now uh so now only one thing is left and that is dollar dot or save and after saving the data we want to stay on the same page so we'll say return redirect and it will be this arrow sign back so it will keep us on the same page now there is one more thing and that is the user may not always want to like change the image from here so here we need to mention if condition uh we'll say if dollar image and we'll give two second bracket and let me just remove this and this second bracket will end after this and now this line of this three line of code only get execute if the user on to change image like if the user give image over here only then uh this tree line will execute otherwise it will not so let me just save it and let me just refresh over here so now let me just change the doctor name from here let's say here kevin and let's change the room number two 704 and let me also change the okay let me just keep the image for now and now if you click the submit button okay that push method is not supported for this route so if you go to our route okay this uh method will be post so let me say post and save it now and let me just refresh then click continue so here you can see that doctor name is changed if you go to our database and refresh here you can see that the doctor name is changed so now this time let's try to uh update the doctor image so let's choose file then i already download some doctor images so let me just say here doctor let's choose this one and click open and if you click submit so i did a mistake over here uh i write get what is in our client extension so it actually will be get client original extension so let me just uh go to our admin controller and let me just say here uh get and let me just say here get client original ori genome extension so now let's save it and now if we refresh it should work here you can see that that doctor image is changed so if you go to all doc dots you can see here the doctor luffy then the phone number specialty so uh let me just also do one more thing is that that when the doctor change that image uh it will show us a message that doctor updated successfully so for it let me just type i will just directly go to my add adddoctor.blade.php and over here you can see that a if condition so let me just copy this if condition so this if condition is for uh showing the message so i'll paste type condition let's say after this give class control v and i'll go to our admin controller and here return redirect pack will say with and inside it we are going to say message then comma and here we'll set doctor details updated successfully so now if we save it and let me just go to our update talk and let me just explain it uh here in the admin controller you can see that we say with message and here in this if condition we are checking if there is any message if there is any message then we are showing the message and we also have a button uh close button over here so that we can close the message okay let me just have this if a message condition after this div container the class container so ctrl v ctrl s and let me just uh click this one let's just change the image after let's choose the sixth image let's click open and if you click submit here we can see doctor updated successfully and here you can see the image is also changed now in this tutorial we are going to see how you can make email validation in laravel it means when you try to register like if you give your name then email and address and password and if you click register then our project will send you a email and then you have to go to your that certain email and there will be a link option over there or button type option if you click that button then your email will be verified and only then you will be able to log in uh if you do not verify your email you won't be able to log in so this is actually really simple then you can actually think so for it uh we need to go to our code and then first of all we need to go to our app then inside app we have models and insight models we have our user.php so if you go to our database and if you go to our hospital and then users here you can see that when someone log registered their name email everything is saved over here and here you can see another fill email verified at it is null so right now what we are going to do is someone register and if their email verified at is null they won't be able to login so for it we just need to go to our models then user user.php and here at the top you can see must verify email so what we are going to do let me just copy it and here you can see class user extend authenticable so we are going to say here implements and after this we are going to say must verify email so this one and it's done so you have to save it over here then you have to go to your config then you have to go to your 45 dot php and if you go down go down over here you can see features email verification then you have to just uh remove this double slash from here and then you have to save it ctrl s so let me just close this one and this one as well now directly we will go to our uh dot enb file and here here you can see that we have mail mailer then main mail form name over here so since we want to send email verification so we also need to use a email so using that email we are going to send email verification messages so here uh mail mailer will be smtp and mail host will be smtp.gmail.com [Music] and we also need to give the mail port which will be 465 and we want to give the mail username which email you want to use to send verification email so i'm going to use this email i mean shakil 7 at the top gmail.com and then you have to give your mail actual password so i'll give my mail actual password and once you give the password you need to give the mail encryption which will be ssl and mail from address let's say this one so user will see this uh see that they receive email from this address and let's say main form name let's say over here form hospital so now let's save it ctrl s and if you change anything in the dot env then you will notice that the environment modified uh restarting server so i'll just say over here control c and again i'll say php serve and press enter so if you change anything in the dot env you need to restart your server so now there is one more thing that we need to do since we are using this mail so we need to make some changes in this mail so that our mail can send verification emails so for it we need to go to that certain mail here you can see that over here my email name is yaminshakil7 at that gmail.com and down here you can see manage your google account so you need to click this and then you have to go to your security and if you go down right now you will see that less secure app access which is on by default it is turned off so you need to make it turned on so once you have this on you are ready to send email verification using this email so now we just need to do one more change we just need to go to our route then web.php and here you can see uh slash home so using this url we are actually sending the logged in user to their home so here we are just going to give a arrow sign then we'll say middleware and we'll give two first bracket and inside it will say auth then after comma we'll give two single quotation and here we'll say very fight so now if we save it and let me just refresh over here and now if we click register and let's give a name let's say ya here ya mean and let's give an email let's say yeah here ya mean on at that of gmail.com and let's give a random phone number let's give address let's say kannada and let's give a password confirm password and now if you just click register here you can see that a text thanks for signing up before getting started could you verify your email now if i go to that certain email uh which is yeah here i mean on at that of gmail.com now let me just refresh over here so here you can see we received a email from hospital verify email address so if i just click this verify email here you can see it took us to our home page so this was actually really easy now let me just go to our uh database and if you just refresh over here you can see that email verified ad there is a date over here that our email was verified at that date so since we have our email verified uh on so we won't be able to login use using user address of gmail.com and using admin at that.gmail.com because uh their value is null so if you want to login to this account that that is really simple just click edit and over here you can see that email verified at and they said button type about here date button type just select over here any date you want and just click go so here you can see that email verified at let me just show you uh that the admin email verified at is null so if we just try to log into our admin page let me just try to log into our admin let's keep the password we won't be able to actually login it is showing us this view so if you just uh go back and if you just do the same for the admin as well let's click edit let's keep the date over here any date you want and after it click go and now here you can see that email verified at has address on so now if we just try to login from here let's click the admin and let's get the password and if you click login so here you can see this time we are able to successfully log into our admin dashboard now let me just try one more thing now let me just show you one more thing that is forgot password option if you just click login and if you click the forward password it is are telling us to give a email now let's say yahia yamin that of gmail.com and if you just click email password reset link here you can see a message we have emailed your or reset password link so now if you go to our email and let me just refresh over here so here you can see reset password notification and if you just click this reset password button so here you can see the email then the password and the confirm password option you can change your password from here let me just change my password onto three four five six seven eight and if you click reset password it will reset my account password so now we can just log in using that password or let me just say that yeah here let me try to login so there you go we are able to successfully login now uh let me just show uh tell you just one more thing people may get a little confused now if you just click confirm uh forget your password and if you just give any random username or any random gmail gmail.com and if you click email password or reset link it will uh show a message that we can find a user with that email address that means that if you go to our database you can see that we do not have that email over here and that is why it is giving us a message so so this is for security reason so this is all actually about this tutorial so this tutorial is actually really simple but if you still have any problem or face any problem or doing email verification or reset password then let me know in the comment section i will give you the proper solution now in this tutorial we are going to uh have a send mail option in this appointment page and if the admin click the send mail button from here then it will take admin to another page where admin can write message to the user and that message will be sent to the user's email so for it we directly need to go the views then admin then show apartment.blade.php and if you go down here you can see the approve and cancel button or cancel column so let me just copy this table header ctrl c and i'll paste over here and here i am going to say send mail and we will go down and over here you can see a tv so let me just copy this tv control c paste over here right now here we are going to say send mail and let me just uh change the button class over here let's start say primary and let me save it now we will go to our browser and if we refresh we will have a send mail button over here as you can see so when the admin click this button it will uh take the users or customer id and and take the admin to another page where the admin can write the message so for it uh let me just go back to our code and here you can see a point id and in the url we are going to say let's say email let's say mail view so let me save it and we are also having a appoint id over here so let me just explain if the admin click this send mail button it will get the id of this customer so right now we need to create this url email view so let me just go to route then web.php and here we are just going to copy a route uh let me just copy this route route get control c then control v and it will be email view let's say email view so we will also have the id and we need to also mention the function name we'll say email view as well let me save it now we will go to admin controller and create this email view so directly go to app http controllers then admin controller let me just go down and here we are just going to say public public function let's say email view and let's also uh send say overhead dollar id and inside it first of all we will return the view so let's say return view and inside it we are going to say uh admin dot let's just say email underscore view so uh we so first of all we need to create this email view so now we will go to our admin folder admin then right click on it and then click new file and here we are going to say email underscore view dot plate dot php so control s and save so i'm just going to copy some code from our uh let's say at doctor.blade.p so from here so let me just copy everything control a control c and i'll paste everything in the email underscore view control v control s so if you just uh refresh over here and if we just click this send email button here you can see it took us on a view but uh there is no css over here but you can see the input field over here so let me just uh go back to our email underscore view and we will directly go at the top and inside this head we are just going to say base then inside a shape we need to give slash public we need to give flash slash public if we miss the slash then it will not work so let me save it and if we refresh now you'll see a proper view so over here you can see a proper view so here you can see some input field and like uh select option and the image option but we do not require everything we'll just uh keep only few of them so let me just modify it a little bit so let me just go down and here you can see name phone number and i'm going to just uh remove this select part so let me just uh remove this div specialty part so i'm going to give this speciality then i am also going to remove this image part so let me now save it and let me just refresh here so we have only three part so in the mail we'll send our user a greeting then a a body a body part then we'll have a given action like uh we'll also send the user a link so that the user can click it and like see various things by that using that link and we'll also have like a regard option over here so let me just modify it uh let's go back to our code and here you can see doctor name so let me just remove it and we'll say here greeting and here the name equal to greeting let's say and after greeting let's say we have the main body so let's just say here body and the name equal to body it will be body and the input type will be text and after this let me just remove the placeholder and after body uh let's say we have like action url let's say action text action text i will explain later what is action text and let's say name equal to action text and let me just copy this ctrl c and ctrl v now this one will say action url so here name equal to action url and we'll write one more things and let's just say over here the main import so let's say in part mail import and it will be text and let's say uh name equal to in part so let me now save it and if you just refresh here you can see we have greeting then the body main body action text action url and the main input so now we have the basic structure is ready to send our image now this is actually really basic uh we are just we just create some input field over here so now in order to send email we need to write some command and over here you can see three command over here uh the first one is php addition notification clone table so if we run this command in our command prompt then it will create to create a table in our migration uh so now let me just copy this control c and now uh we'll go to our project then let me just write over here cmd and if you just paste it psp addition notifications clone table and if you press enter you can see migration created successfully now if you go to our code and then if you go to our database then migration and inside it you can see a table create notification table over here so we do not have to uh modify anything over here so after so once we run that command run this command we need to run the second command which is psp addition my gate so let me just say over here so let me just say over here php rt sun migrate and if we press enter it will migrate our notification table so now if we go to our database and let me just refresh over here so here you can see we have another table called notification so if you just click it you can see some data over here so now uh we will run the third command which is psp edition make notification my first notification now this is a name now you can uh give any name over here so uh let me just uh go to our common prompt so here i'm just going to say phprt sun make clone notification then i'll say let's say our name will be sent email notification you can give any name you want so if we press enter you can see notification created successfully now if you go to our code and if you go at the top you can see that inside our app you will find a new folder called notification and inside this uh notification folder you have sent email notification dot php now here uh you can see that some main related things so we need to modify some things over here so here first of all we are going to declare a variable and it's going to be private so let's say private let's say dollar so let me say details and after this inside this public function construct we are going to say dollar details and inside this we are going to say dollar these this arrow sign details equal to let's say dollar details now we need to go down and over here you can see public function to mail notifiable and after that we have written new main message now here you can see line action line only three input field but you can have multiple of them so let me just copy one of them control c and let me just show you uh ctrl v and here we're just going to say let's say greeting so we are going to say in our hair greeting let me just remove the this line from here and inside this first bracket will say dollar this this arrow sign d tails and we'll give two third bracket and inside it uh let me just say greeting so after creating let's just over here let's say this one will be for the body so let me just copy this one ctrl c and ctrl v and here uh we are going to say in this variable body and after body we have the action now in action the first one arc as a text action test and and the second on or as a url so let me just uh paste it over here and we are going to say here action text and after this we are going to give a comma and we are going to paste the same things again and this one over here will say action url now the first one always uh in this action the first one uh considered as the text and the second one considered as a url and this is the last line uh so let me just remove it control v and instead of getting let's just say in part and let's save it control s so now we will go to our uh email underscore view dot play dot php and we'll go at the top and here you can see a form action equal to some url uh is given over here and we do not require enc type over here so we need to give a url name over here let's say here send email and we also actually need to send the id uh to which user we want to send this specific mail so uh if we just go back to our browser and if you go to appointments again over here you can see that when we click the send email we are uh coming over here so we also need to catch that uh specific uh email id so for it we need to go to our admin controller again and here you can see we are returning the email view from here so let me just say here uh declare a variable over here so let's just say dollar data is equal to our table name which is appointment then about loan let's find dollar id and we are going to just say here comma compact and inside it we are just going to say data so over here using this id we are getting the specific uh user appointment and stored it in this dollar data variable and sending that specific data to our email view and if we go to our email view dot plate dot php so we can just write over here dollar data this arrow sign id so now we can uh send that specific id to our specific route so now we will go to our web.php and this time uh we'll copy this route ctrl c ctrl v now the route type will be post since we want to uh send all those data to our controller so now uh here we are just going to say in this url we are going to say send email and we also need to mention the function name let's say it will be sent email as well so let me save it and this time we will go to our admin controller again and we are going to say here again public function same email and we are going to say request request dollar request then we need to give a comma and then dollar id so let's keep two second bracket and first of all uh we will find the specific user so let me just say over here again let's just declare a variable dollar data is equal to appointment table double clone find and inside it will say dollar id and after this we need to declare another variable uh let's say dollar details then equal we we need to give two third bracket and then we'll give this uh semiclone over here and inside this dollar details we are going to write some uh code so so first if you go to our send email notification here you can see we declare some uh variable kind of thing over here you can see greeting then body body then action text action url in part so we are going to mention all those things uh in our controller so uh so we are going to just go to our admin controller and say over here greeting is equal to and we'll say dollar request and this arrow signed and if we now go to our email underscore view dot plate dot php and here you can see the level greeting and here you can see that our name is equal to creating so so whatever the admin right uh in this text it will be sent uh over here so we are going to say greeting and after greeting uh let me just check again uh we have the body action text action url and in parts so so let me just copy this one ctrl c and let me paste it four times on two three 4 so that so the second one will be body so let me just remove it and directly say here body and after body we have the let's say action text action text and after action text we have the action url action url and the last one us or import let's see here in part oh i did a mistake over here there won't be any semi clone it will be actually comma so let me just remove it comma and here comma as well and we do not have to give any comma for the last part and we also need to give a arrow sign after this uh equal so let me just give this uh arrow or you can say is greater than sign so after this we are going we need to say so now here uh we need to say notification and to double clone uh send and inside this first bracket we need to set this dollar data here with that we just mentioned over here dollar data so dollar data then we need to give a comma and after this we need to say new and here you can see that uh our this file name is sent email notification dot php so here we just need to say send uh email notification and we need to give first bracket to first bracket and inside it we need to say this dollar details ctrl c then ctrl v and we need to end it with a semicolon and since we are using a notification and also this sent email notification so we need to add them at the top so here at the top we need to say use notification and after this we will say use app backslash notifications backlash uh send email notification so here you can see that we write app notification backslash email notification if you go to app then you will find a notifications folder and inside notifications we have sent email notification.php so after sending the email we want to stay on the same page so we'll say return or redirect to first bracket this arrow sign let's say back so let me just save it and let's go back to our browser and let me just refresh over here and let's say we want to send them email to this email address but before that i just want to mention one more things uh if you go to our dot enb you can see that uh we have our main mailer equal to smtp we already set up our uh email over here so in order to send email notification you need to uh set up your dot enb uh main mailer option over here so you can see main menu smtp mail host tp equal to smtp.gmail.com we have a mailboard which is 465 and we have a mail username which is ms shackle7 at that gmail.com and we have and you also need to give the mail actual password your mail actual password then the mail encryption is ssl and main form address is actually same on as the username and mail from name actually i mean what will be your the main name so from here we just write form hospital so once you uh if you are using this mail then you need to go to your mail that's certain mail then here you can see yamiche 7 at that gmail.com then you need to go to manage your google account and then you have to go to security and if you go down here you can see less c code app access which is on if it is not turned on then uh you have to make it turn on okay so by default it is turn off so you have to have it on just like me so once you have it you will be able to send email notification so let me just click over here send mail so here uh at the top you can see email view and there is also id which is six so here i'm going to say in the greeting i for me in the body uh this is my laravel email and let's say in the action text subscribe this channel and let me just copy this url now this is my channel youtube channel url so i'll paste it over here and let's say input will be thanks for watching now if you click submit it will send a mail to my that certain email so it's saying that uh something is missing in our models uh appointment model so for it let's go to our appointment so let's go to models then appointments and here uh you we need to use over here inside this uh class we'll say uh use noti firewall and we also need to add on one line at the top so let me just go to user.php and over here we are just going to copy this line uh use illuminate backslash notification backslash notifiable so ctrl c and i'll paste it inside appointment model so control v so let's save it now let's go back to our browser and let's just go back over here and if you just click submit button here you can see that the page reload is complete now if you go to our email and if we here you can see we received an email notification and if you click it uh here you can see hi from me this is my laravel email body and here you can see subscribe this channel a button option and thanks for watching and if you click this subscribe this channel it will take you to my channel here you can see this is my channel that uh that this is the link i give over there so uh we should also uh show a message that the email is sent is successful so for it let's go back to our code and we'll go to our admin controller dot php and here we're just going to give this arrow sign will say width just like before we are going to say message then we'll give a comma and then here we'll say email send is successful so let's save it and we'll go to our let me just show you we'll go to our email view.blade.php and if you go at the top here you can see we already copied this if a session message part over here we have the message if there's any message then it will print out the message and there is also a close button uh to close this message so let me just save it again and let me just and let me just refresh it over here and let's over here uh just say hi from the hospital and let's say uh you can come uh tomorrow at 9 00 pm and let's say uh check out this link check out this link and and let's keep the url and let's say thanks okay so now if you click submit we'll see a message over here uh email send is successful and if you go to our email again and let me just refresh over here you can see we receive another email if you click it you can see you can come tomorrow at 9 pm check out this links and thanks now in this tutorial i'm going to talk about what we did in this tutorial and i'm and we'll also fix some issues or problem that we have in our project so first of all let's see what we did in this tutorial so here you can see that we have a navbar we have a login and registration option over here we use a template in this tutorial and we also added those doctor images their name and specialty from our admin dashboard and if you go down here you can see make an appointment user can make an appointment from here uh even if he is logged in or not now let me show you what a logged in user can do and here you can also see a register option if you a user can register uh by clicking here you can see the user needs to give his name email phone number address and obviously some password as well and uh here you can see we have a login option user can log in from here and if user forget his password he can get the password by clicking forget your password then a email will be sent to users email so let me just login to our user uh let's keep the password and if you click login here you can see this is our user dashboard uh you can see that uh a login user has a extra feature and that is my appointment and uh the user can also see his profile and also log out from here and let me just uh create a appointment from here uh let me just click over here let's say name will be uh yeah mean and let's give a user email address let's say user at that of gmail.com let's keep the date from here and let's also select a doctor you can see the doctrine name here if you go lk top you can see the doctor over here you can see the doctor name and the specialty so here you can see that if you click it you can see the doctor name at their specialty as well so let me just choose this one and let's just choose a number phone number so that the hospital can contact with you and let's just enter a message let's just say uh checkup checkup for me and if you just click submit request it will show you a message that appointment request successful will contact with you soon now if we go to our appointment here you can see our appointment over here you can see that the date which we choose and the message and also the status status is in progress it means the admin needs to confirm uh confirm the status if the admin confirm the appointment then uh this status will change from confirmed so and the user can also cancel their appointment by themselves if the user just click cancel it will show a message that are you sure to delete this and if the user click ok it will delete this appointment let me just show you if i click ok it will delete this so now let's uh let's just log out from here and let's go to our admin dashboard so just let's login to our admin here we are going to say admin at that of gmail.com let's give the password and let's click login so here you can see this is our admin dashboard now if you click add doctor it will take you to this page and you can add a doctor from here let me just add a doctor let's just say here smith let's give a doctor phone number and let's click a speciality let's say heart and we also need to give a doctor room number let's say three or two three or three and you can also choose a doctor image so let me just uh choose a image from here uh we'll say doctor let me just say okay here is a doctor image if i just click open here you can see dr six dot gpg now if you click submit it show us a message doctor added successfully now uh if you just go to all doctors here you can see all the doctor over here now the admin can update or delete a doctor if your admin just click delete and if the admin click ok this doctor will be deleted now the admin want to like update their data or anything admin just need to click the update button it will take admin to a different page with that data you can see the doctor name the phone number the specialty and the room number and it is also showing us the old image and admin can also change their image from here as well let's just say the uh change the mobile number let's just say zero zero zero just a random number and if the click admin click submit here you can see doctor details updated successfully if you go to all doctors here you can see that the phone number is changed and we still have the old image now let's go to appointments and if you go to appointments the admin can see the customer name then their email address here you can see then admin can also see the customer phone number then the doctor name which state uh they want to visit a doc visit a hospital and also the message and here you can see the status is in progress here uh we have two button approve and cancel admin can uh cancel the appointment also approve their uh appointment if the admin click approved here you can see that the status is changed to approved and then after that admin can also send the email to the user over here you can see we have a send email button over here if the admin click send email it took us over here this page you can say any message let's just say hi from the hospital let's say uh in the body you can come tomorrow at nine and let's also say uh admin can also give any link if the admin on let me just cop server here and let me just copy this url and i'll paste it over here and in the in part let's just say thanks and if the admin click submit button here you can see it is reloading and it will send an email to that specific user so here you can see email sent successfully now if we just go go to that certain mail so here you can see that uh this email is yeah here yeah i mean on at that gmail.com and if that user open this mail here you can see that hi from the hospital you can come tomorrow at nine check out this link and at the end thanks if someone click this link it will open it open that link over here you can see google.com so this is everything we did in this project now this project is really simple if you are a beginner or if you want to like create a project for your university or if you want to learn laravel then this is the perfect project for you i try to explain everything in this project uh so you will have the basic idea how to create a project in laravel and it will help you improve your growth a lot if you complete this project now let me just fix some issue that we have in our project now first of all let's just log out from here and here you can see that where right now is not logged in now if you go down you can see that the image size is equal but when you log in let me just log in let's just go to user let's keep the password and if you click login here you can see right now we are logged in and if you go down here you can see that the image size is changed they are a length height is not same anymore so in order to fix this uh we will directly go to our code and we need to go to our user folder then if you go to home you can see that our home page actually inherit uh this user.doc.page so we'll directly go to doctor.blade.php and over here you can see from here we are actually showing the image so here you can see height equal to 300 px so we are just going to remove this and we will just say her style and inside this style will say height let's say 300 px and after this 300 px will say import tent so uh it means if we give this important it means whatever the css applied for the height uh it doesn't matter the image height always will be 300 for this so if we save it now and if we refresh here you can see all the image height is right now same okay now this is one thing now uh let's let me just click this my appointment over here now if we click home if you want to uh go to our home page it doesn't take us to our home page or if you just click over here on health it should take us to our main page so we need to fix this as well so for it we again just directly go to our home dot paid php then uh if we go down here we can see the on health this is actually the this one so in this href we are just going to say 2 second bracket and we will say url and to single quotation and then slash now if we save it and let me just refresh over here and now if you click this on here but okay if we click it uh okay it doesn't doesn't work i think my appointment has a separate page so let's go to my appointment.blade.php and over here you can see that uh we have a separate on health over here so i am just going to remove this hash and going to say the same thing over here i am going to say url and inside this single quotation just a slash now if you just save it and if we just refresh our hair and let's just click this on here you can see it took us to the home page now let's also do the same for this home so let's go to our uh let me just here you can see we are right now in my appointment.play.p so here you can see home so we are just going to remove this and give two second bracket then we are going to say url we are going to write the same thing lets save it now we will go to our user then home.php and we are going to say the same thing over here as well let's say here url and inside single quotation just a slash now if you save it and if we refresh now if you click home it will uh keep us on the same place now let's go to my apartments and if we click home it will take us to home so this is on issue that is solved now let me show you another issue that we have in our project now let me just go to route then web.php now if we go down here you can see add doctor view uh this is now this is actually for the admin you can see with admin controller now if we just uh let me just copy this control c and if we just paste it over here ctrl v and press enter you can see that it took us to the admin page which isn't correct so we need to fix this so for it we like to go to our admin controller and and over here let me just check the web.php and here you can see that its function name is add view so here you can see add view so we are just going to give a condition over here first of all we will uh check if there is any odds so we will say auth double clone id so if is there any auth id it means is there any user is logged in then we'll give two second bracket and after this we are going to check the user type whether it is admin or user so for it we need to give another if condition over here and we'll say auth double clone user to first bracket this arrow sign then we'll say user type then equally call on now in the database on uh we already mentioned that on means uh admin and zero means user so let me just show you again just to be sure if you go to our user here you can see zero and on on means admin so uh if there is a user type is on only then uh we can return this view ctrl v or if the user time is not on else then we'll go to else condition else uh let's just say return return redirect uh will stay on the same page hit on redirect back and if there is uh no auth id so for it we need to also give a else condition will give else condition i will say return or let's say return redirect and will return to login page so now let's save it and okay now since we are using auth over here so we also need to add art at the top so here uh let me just go to our uh home controller dot php and i'll copy this use illuminate backslash support backslash packet backslash auth and i'll paste it inside admin controller at the top so ctrl v ctrl s now let me just refresh over here and if you right now see over here add underscore dot underscore view and press enter it will not take us to that uh admin view and so we also actually need to do the same for uh our other view over here as well so it is really simple let me just uh do it for two of them so that you can understand it easily so let's just copy this if the second bracket and this if condition ctrl c and here uh let's do this this show appointment part now here let me just go to our route and here uh show appointment let's see let's see here you can see show appointment now if we just say here show appointment happy and if you press enter here you can see it again took us to this space so now what we are going to do uh we will just go into admin controller.php and here after this second bracket we are going to copy that paste that code that we copied here you can see if auth id and if condition and if the user type is on then only return this view otherwise not so i need to close this if so we'll give a second bracket over here and if the user type is not on it means if the user type is zero it means the admin then uh return redirect back return uh redirect to first bracket and sign back but we also need to uh in this if condition which will in over here so now we'll say here else return redirect and will return redirect to login uh let me just explain again first of all we are checking if there is any auth id if there is auth id then we will check the user type is uh then we check the user type if the user type is on it will take uh this admin view and if the user type is not on uh then it will stay on the same page and if there is no logged in user then it will directly go to this else condition and uh then it will show us a login view so now if we save it now let me just see over here show appointment and if you press enter it will keep us on the same page so you also need to do the same for the rest of the function over here uh and we also need to do for the home controller as well let me just go to home controller and let me show you for home controller as well so here you can see we already did this for the redirect and here let me just do this for and here let me just uh we just have to do it only for my appointment part over here you can see so here we already write a auth condition so we just need to give only on if condition uh inside this if so here uh we just need to find out the user type whether it is admin or user so it's a auth double clone uh will say user to first bracket this arrow sign will say user type equal equal uh if the user type is equal zero because uh we want to return a view for user right now so we'll give two second bracket and inside it uh let me just copy everything over here control x and i'll paste it inside them control v so now let's save it so uh this is all about this tutorial so so this is how all the issue is solved in our project and i tried to make this tutorial as easy as possible but if anyone face any problem or any confusion or any error then let me know in the comment section and also let me know how much uh you like this tutorial uh what was your experience about this tutorial and if you like this project or tutorial and if you want to learn more laravel then subscribe this channel because i upload laravel related video every day so thank you very much for watching stay tuned and stay healthy
Info
Channel: Web Tech Knowledge
Views: 6,177
Rating: undefined out of 5
Keywords: hospital management system, laravel project, laravel project tutorial, hospital management system project in laravel, laravel tutorial, laravel hospital management system, hospital management system in laravel, hospital management system in php, laravel project tutorial for beginners, laravel project tutorials, laravel project for university, hospital management system project in laravel with source code, laravel 8, online hospital management system, hospital management software
Id: Hh1atKEzNWs
Channel Id: undefined
Length: 231min 42sec (13902 seconds)
Published: Sun Sep 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.