Hey Friends, welcome Back to BitFumes, I am your Host Sarthak and you can also call me Ankur
this is a channeI talked about the Laravel and the cool thing about Laravel so
if you are new to this know don't forward to subscribe subscribe subscribe
ok so we have successfully created the multi or system that means one section
for the login of user and other section for the login of admin and totally
different sections each in other ok so now in this episode we are going to
setup the forward password system that means if I go to this forward password
it will land me on the admin reset password because this is not configured
so it is on the user reset password and if we type here I my email address that
it will send me the link to reset my password so firstly set the reset
password for the admin so I will just log out from user and now go to admin
from here when we when we hit the forward password users V we expect admin
reset password so let's see how we will do that for that we will go to sublime
text close everything go to this controller inside HTTP and inside
controllers you will find admin folder which we have created in the last two
2/3 so inside this you can see there is a forward password controller here you
can see use send password reset email if you are using sublime text then it will
show you the original path but otherwise you can go to vendor level frameworks
codes eliminates foundation or send password please go to this file and you
can see this show link request form let us copy this and overwrite in your admin
forward password controller and obviously this is not the auth dot
password it is admin dot password dot email now go and refresh and you can see
it's admin reset path now we have successfully created this
let's try to send that email so we are sending email another tab I will open my
gmail account so let see what happened taking time and yep you can see that we
have email your password reset link so let's see the email so we have this
email and now you can see this button let us click this button so I will click
this button and it will land me on the reset password but again we does not
want the reset password of user we want the admin reset password okay and for
that we have to go to this route called admin word / reset / token but it will
also showing us this form so for that we will go to the controller of reset
password controller and we will do the same thing as we have done in the
forward path / controller we will go to this file and copied from here over
right inside our reset password controller and here give it a name of
admin dot password dot crease it now hit refresh and you can see it will give you
an error because we have not imported the request so let's quickly go again
and copy password and Roth and request everything because we will use all this
auth and password also so let's just use everything again so here it's good now
click refresh and you can see admin password reset password but you can see
this is not the link given by our email when you go to the email it will give me
only the password not the admin password reset okay so let's see how we will do
this at that means we will send the send the password reset email with a correct
link inside this reset button so for that you will go to the forward
password controller and you can see when you go to this file send password reset
email you can see there is a broker which is offending email okay so it is
send reset link we will go to this file password broker and inside this file you
can see failed password reset notification go to this it will be
inside can reset password and you can see at the top it is reset password go
here and now you can see this email has been sent by the level so it is taking
the route of password dot reset not the admin dot password reset so how we will
do that obviously this is a notification so we will create new notification for
that you go to the command prompt and type PHP artisan make obviously
notification notification name is admin reset password notification and
obviously you can name it anything you want but I like that descriptive way of
naming so hit enter and you can see the notification has been created
successfully so well that notification it will be inside app folder it is
notifications go to this admin reset password notification and you can see
this is the notification created by our PHP command but we want to give this
message so we'll just copy this message from here close this and go to this new
notification we have created and paste it here and instead of disk I will say
admin dot to password dot reset okay and obviously I will say admin reset
password so inside the button we will get admin reset passwords
okay so it's good so we have to click created but inside this notification you
can see it will be getting the token so we will give the token here so I will
give token and here I will say this slash this token is equal to token and
it's good so just close this and now what I want to do I want to just
override this send password notification to our admin controller and Here I am on
the admin controller and I want to give this function here and instead of this
notification I will send admin reset password
notification which is this okay so it is getting the token and token we have
given inside our notifications Lexie's is that everything is correct or not so
go to our level click refresh otherwise give me a CSRF token errors bit soon hit
enter and now we will expect an email and the yep we get the email the let's
see we have a problem we does not get the required thing let's see what's the
error okay the problem is here when you go to the forward password and you know
send password yes here when we go to the forward password we will go to this send
password reset email and at the bottom just copy this prokhor from here and
overwrite this broker in your forward password reset width of provider name
and obviously we know that for admin the providers admin ok so this is completed
ok so let's go and try again
and it will give me the error because password admin password not found so we
have not imported again the problem we have to import this let's import request
also ok so I think it's good let's see
admin reset password not equation is not imported so obviously we have to go to
the admin model and we want to use app / notifications slash admin reset password
notification okay and now click reload and you can see it
is loading that means email is sending we are expecting an email we get the
email and now you can see it is admin reset password so when I hit here you
can see it will land me on the correct page before we required ok
but here the next thing we are going to make changes is that when I go and the
let's say we are going to create create the password new password so let's say
password will be 1 2 3 4 5 6 after this let's say 1 1 1 1 1 1 1 1 1 1 point 1
reset password and you can see it is doing nothing so let's try to login with
new password so let's see what happened 1 2 3 4 5 6 no 1 1 1 1 1 1 so hit enter
and you can see it will give me error so let's try it with old password 1 2 3 4 5
6 and yep we are logged in so where that resetting gone select right log in with
the user with the password we have respected so 1 1 1 1 1 point so let's
login and you can see actually the password reset it for the user not for
the loop admin so we have to make changes in our reset
password' controller so just close everything go to the HTTP controller
admins and reset password' controller here obviously we have shown the page
but we have to make other changes so go to reset password dot PHP okay go at the
bottom and you can see there are two thing the guard and the broker copy
these two close overwrite it inside your password with edge controller and
obviously you have to give a provider name inside broker so it will be admins
and the gardening inside the guard so it will be only admin not against so we
have successfully made the changes here now go to the now go here and click
refresh send another email let's delete this email okay close this and we get
the email let's see let's go to password reset link reset the password into to to
do to do to do to do to reset password and yep here on the admin page let's see
is that everything is correct or not because we are on the admin homepage
that means I think everything has correct so let's log out and go to the
route of Edmund go here and password will be to to to to
do to hit enter and yep the password is reset so you can see we have
successfully created the multi earth system we have successfully created the
password reset system for admin so in the next episode I am going to show you
how you can log in with a different roll of the admin that means one user
one admin user has the role of admin one admin user has a role of editor one
admin user has a role of let's say publisher so for each and every user we
want to redirect to other page that means two of obviously a home page of
every other role of user so we will make in the next episode if you have doubt in
this episode if you click on any thick then you please feel free to comment me
I was always ready to respond and if you have any doubt in your project feel free
to comment me you can follow me on Facebook Twitter and Instagram you can
also message it there and share this video with your developer friends and
don't forget to subscribe that is the most important thing tuned forward to
subscribe we'll meet in the next episode till then we have tea goodbye