Just a small tip, you can call except directly from the middleware object like this: $this->middleware('guest')->except('logout', 'userLogout'); Instead of writing an array. Thanks for the tutorial!
@TahirBhai7 жыл бұрын
Yes you can but the most authentic and futuristic technique is to use Array.
@renancoelho56577 жыл бұрын
Whool! So much thanks to you guy! I 've created a complex and complete authentication system with 3 independents domains on my website. You can login into my website by using three independent sessions: send password recovery mail, login/logout, register, etc, etc. Thanks to your videos
@tangaye7 жыл бұрын
How does DevMarketer pass the right route in the header to logout admin or user?
@sauryapaudelfr6 жыл бұрын
Can you help me with this? how to show session of either user on the same page. Suppose I have user and admin session, admin being the secondary auth, how to use admins session when user is not logged in for the pages where users session is stored and displayed.
@SaifulIslam-dn3tj6 жыл бұрын
Thank you so much , sir. This code not work properly in laravel 5.7. Please make a video what is the change in 5.7.... Please sir
@mephalanb307 жыл бұрын
Excellent stuff, many thanks, looking forward to the final instalment. For the benefit of anyone else who might have a bug at the end it took me a few minutes to spot I hadn't removed the request object from the copied logout function.
@tangaye7 жыл бұрын
How does DevMarketer pass the right route in the header to logout admin or user?
@yuhanjiang7 жыл бұрын
Thank you, Alex! Your tutorial is always the best.
@spappas19867 жыл бұрын
I used the @component to separate the navigation from layout.app and with the same logic that was used in the who.blade with the @if (Auth::guard('web')->check()) to set the URI to the different users/logout route and the admin/logout route. I had to change the route for both to "POST", and it works, but only if logged in as either user or admin, not both. At least this gets the logout functionality into the navigation link for both users and admin. Great tutorial!
@spappas19867 жыл бұрын
It doesn't work with 3 different types of users. Any ideas?
@nooreekhayrattee18466 жыл бұрын
One of the best tutorial...It really helped me..
@야씬6 жыл бұрын
Great tutorial, I would just like to know where I can find the written tutorial. I've checked the description but it says coming soon. I also would like to ask what the best practice is to hide the admin routes from any user.
@imranhadid80825 жыл бұрын
Thanks a lot. I'm using laravel 5.8 actually this part 4 helps to remove all the errors.
@mtzrmzia5 жыл бұрын
it works for you?
@imranhadid80825 жыл бұрын
@@mtzrmzia Yeah it works. watch and follow all the videos. hope it'll solve your problem
@mtzrmzia5 жыл бұрын
@@imranhadid8082 please upload to GitHub and let me fork :/
@imranhadid80825 жыл бұрын
@@mtzrmzia Sure. I'll make a new repo and upload it tonight. I'll let you know
@mtzrmzia5 жыл бұрын
@@imranhadid8082 thanks. i will apreciate it
@peterballa60606 жыл бұрын
Thanks great video series! You helped me a lot to understand the guards. Now I dont have to separate admin-customers into different domains and I can share the configs, models and components etc.
@muhammadzeeshan074 жыл бұрын
hi there ALex, i want to know that if both admin and web users have data in there sessions, so when we logout as admin or user will that particular logout flushes the session data of that particular auth guard or not ,because it this video you suggest to remove that lines which refresh the sessions, and we know that guard drivers are sessions in auth.php
@aliprogrammer36447 жыл бұрын
helloooo it is long time to see you again. please be sure we are waiting for you every day
@sangeeth8104 жыл бұрын
professional teaching
@FarhanKhan-cp2kw5 жыл бұрын
How can I change the default @auth ... @endauth inside welcome.blade for Admins.....? I have no idea where to start looking...any guidance/suggestion is appreciated
@muhammadkamranjaved24247 жыл бұрын
Which syntax is use to fetch Admin ID in other controller? Will it be like this? $category->admin_id = Auth::guard('admin')->id;
@masetenicholas45205 жыл бұрын
This part 5 has been on coming soon for some good time now.
@sathisdhanasekaran69365 жыл бұрын
Thanks Man......You Save My Time..Thank For Knowledge.....
@richasugandhi29545 жыл бұрын
Hello, Auth::guard('admin')->logout(); Is not working on laravel5.7 version Please help me.
@АндрейПугач-э4р5 жыл бұрын
Did you find a reason?
@alihassan17534 жыл бұрын
you have not used "use Illuminate\Http\Request;" in your LoginController.php but running properly how ?on the other i got error please explain.
@TheBurf3166 жыл бұрын
If you use the default welcome page and the template for nav of laravel, which is better to use bootstrap 3 or 4?
@aosm_llc7 жыл бұрын
when I type logout in the browser it works, but when I use the Logout drop down at the top right of the screen, both users get logged out simultaneously
@xanthos7337 жыл бұрын
This behavior is normal if you wish to change it you need to edit it
@loremipsum5747 жыл бұрын
Sir, do you have any solution for this?
@DaveSohan7 жыл бұрын
Did you not watch this video??
@ahte157 жыл бұрын
Mmh well, you can do something like in your app.blade.php a href="(Auth::guard('admin')->check()) ? route('admin.logout') : route('user.logout')">Logout
@TahirBhai7 жыл бұрын
You should remove the form from logout, because as you can see he just wrote a route with get for logout admin, so you need to just use anchor and put that route to the href and that is it. You should remove the onclick from anchor and also the form below the anchor. It might solve your problem.
@adewaleadeleye31657 жыл бұрын
I used this tutorial on laravel 5.5 and everything worked except that the logout for admin logout the user instead. There are few file modifications in laravel 5.5. The handler.php file has been moved to laravel>framework>src>illuminate>foundation>exception>handler.php. I used the following code when the sample provided was showing errors. $guard = array_get($exception->guards(),0); switch($guard){ case 'neutral': $login = 'admin.login'; break; default: $login = 'login'; break; } return $request->expectsJson() ? response()->json(['message' => 'Unauthenticated.'], 401) : redirect()->guest(route($login));
@loremipsum5747 жыл бұрын
@Adewagold Adeleye, did you find a solution for this error?
@hellcchin40417 жыл бұрын
Thank guys you save my day, salute!!!
@juanrincon65767 жыл бұрын
Perfect, but what about a single login form and multiple users auth? i mean, Mod, Admin and common users. To log in on a single login form. Roles i think is the name
@aaronshed7 жыл бұрын
You might as well just have a database field for user type.
@andersonmartins38627 жыл бұрын
Alex, first of all I would like to thank you for the videos, congratulations for the great work! When I log in to both, when logging out an admin (example), the two sessions are terminated. Could you explain me how to change the logout method so this does not happen? Thank you!
@robdorn4207 жыл бұрын
I don't understand the benefits of multiple authentication over role/permission based authorization. Is the latter not more flexible?
@bubaidas60205 жыл бұрын
If i open two login panel into the same browser but after login as admin or user if i logged in another then it going to the Page 419 | Expired. But when i refresh the page then it's working properly.
@tangaye7 жыл бұрын
How does DevMarketer pass the right route in the header to logout admin or user?
@yonann78996 жыл бұрын
I am got error with laravel 5.5 "Method [guard] does not exist on [App\Http\Controllers\Auth\AdminController]."
@leumasrodama20107 жыл бұрын
Hello. Why is it that after I log out on admin page, I can still access the admin whenever I click back on my browser? I expect that it will be redirected to the login of admin..
@HoangTran-qv9iw7 жыл бұрын
Thanks a lot . But i'd like to ask when Written tutorial comes out? I wanna read the doc to fully understand it, it is confusing! :)
@TanjilBhuiyan7 жыл бұрын
Thank you for this video. i have a question default exception was like : ->except('logout'). but you used them as an array. default one does not work?
@JacurtisTutorials7 жыл бұрын
Both work. Lots of ways to do the same thing in Laravel
@yccodei7 жыл бұрын
If I had multiple admins and each one have separate job_title, How could I separate them in controller so admin with administrator job_title can access some controllers and another admin with supervisor can access another controller? help plz
@midith3166 жыл бұрын
what IDE are you using in this video?
@pranavmandlik58526 жыл бұрын
i tried same code but when i try to login with url /login it shows user login form and when i fill that form after successfully submission it redirects to admin/login page and when i try to enter url /home it show logged in users dashboard
@AJ36007 жыл бұрын
At last you saw my email. ☺☺
@Shinerweb7 жыл бұрын
when i remember me checkbox then username and password not save after logout
@agungngurahabhinaamitabha74637 жыл бұрын
then how can we registered the new admin jac?
@mostafakawsarlive85747 жыл бұрын
Thank you dear for log out part
@tangaye7 жыл бұрын
How does DevMarketer pass the right route in the header to logout admin or user?
@virendraarekar5395 жыл бұрын
How to implement facebook like page creation and post in our app also big question is that how to maintain and regenerate token after first log in.No need to log in again and again for facebook app. Can you suggest me in one of those languages like node js or react or php.Please help me.
@vakasghulamnabi92597 жыл бұрын
my session flash messages are not working after making guards and providers
@andorkonet7 жыл бұрын
Hi Alex! Can yout help me? I'm looking for best Atom packages. Could you tell me please what atom packages are you using and recomand it? Thans for help.
@petelukz3427 жыл бұрын
Bummer, I was hoping you’d go into a little detail on session expiration in logout. That’s a missing subject that has been difficult to deal with.
@chiragtelar93816 жыл бұрын
Thanks @alex your video is useful for better learning once again thanks alot. :)
@vincelouiechu67027 жыл бұрын
Hello. How can i show the error message if the credentials does not match on records just like default login. And how about if i want user and admin to access the page .. just like this public function __construct() { $this->middleware(['auth:web'], ['auth:admin']); } . Thanks
@GurvinderSingh-bz9ys4 жыл бұрын
Does your part 1,2,3,4 works with Laravel 7? And Is Part 5: Forgot My Password Functionality across Multiple User Types """COMMMMING"?
@creativeworks986 жыл бұрын
Great video! Thanks a lot
@ramirotapia22176 жыл бұрын
Saludos Iám from Chile and i find your videos great keep it up
@FarhanKhan-cp2kw5 жыл бұрын
Please tell me the name of the Sublime Text Theme you are using!! Thanks in Advance
@user-ub6yo7mg1n5 жыл бұрын
One Dark
@waldo21m6 жыл бұрын
Hi Alex, Thanks for share the videos :D saludos desde Venezuela :D
@ajaymasurkar59097 жыл бұрын
Hello sir I want to understand basic of middleware ,auth if any video about this please share link Thanks
@DazzyDude006 жыл бұрын
The problem I'm having, is that it logs me in only after second attempt, when I try to login to admin first time, it redirects me to user login, but if I try to login again it works, same for the user
@tecocode60706 жыл бұрын
It doesn't work on laravel 5.6 I can't figure it out how to log out with your method
@rivalcorps7 жыл бұрын
long time no see alex lol
@Msharulazwan6 жыл бұрын
Hi Sir, i follow your tutorial from part 1 until part 4, and i have trouble with Auth guard. Let say i use @if (Auth::guard('web')->check()) Logout user @else echo Logout admin @endif but if user and admin is login in same computer, the first if will be always true. So how to solve this problem ? Sorry for my bad english.
@saurabhparekh98577 жыл бұрын
It is great tutorial. I have two guards name vendor and admin. If I logout from admin guard and try to login from vendor guard with same browser it first redirects me to admin login page. if i go back in browser and refresh the page it redirects me to vendor dashboard. Same issue if logged in as vendor and logout from it. Now try to login in admin guard from same browser it redirects me to vendor login if I go back and refresh page it redirects me to admin dashboard. I had follow all your method for login and logout for multiauth. it works with different browsers. I don't able to find issue with session or something in same browser. can you help me with this?
@RobertNicjoo7 жыл бұрын
please show how to make second register form for other type of users, I followed this series now my auth:users are just user but i also made companies user the login system works perfectly as you teach in your videos but register form keep giving error and you don't have that part in your videos. Thanks.
@JacurtisTutorials7 жыл бұрын
As of right now, we already have two different register forms, that we did earlier in the series. You can customize the look of them however you want in the view files.
@RobertNicjoo7 жыл бұрын
as you said in earlier of part 2 video is not worth to showing! now that I made my second register form with all different fields when i try to register as my second type of users which has to save in different table and not the users table will get error of "Type error: Too few arguments to function App\Http\Controllers\Auth\CompanyRegisterController::create(), 0 passed and exactly 1 expected" I would be appreciate if you show us how to register second type of users (allow them to register). PS: we have 2 login form in this series not 2 register form.
@DjVinny10156 жыл бұрын
Your routes for logout must me set to POST, not GET, and once this is accomplished for some reason, logging out of user takes you to /admin
@DjVinny10156 жыл бұрын
it seems my guard is showing 'admin' on the user page
@BalGopalLalShrestha7 жыл бұрын
I need to redirect admin logout to admin login page but this code is not allowing me. Can you help me out in this?
@7osSam527 жыл бұрын
just go to the AdminLoginController and find the method called logout, and set the return to : return redirect(route('admin.login')); // where admin.login is the name of the login route for your admin
@kebonbaba72093 жыл бұрын
perfect
@KamranBhutto7 жыл бұрын
Thank you, Alex :)
@rohmatmret82657 жыл бұрын
any one can tell me , Why function logout(){ Auth::guard('web')->logout(); } thanks
@crisperlawas29686 жыл бұрын
where is part 5?
@erosmarcuszamora88285 жыл бұрын
It works fine on Laravel 5.7 guys. Maybe you need to re-watched the tutorial if you have an error. Btw I didn't use the array in 'public function __contstruct()' part in both controllers This is my code: in LoginController.php public function __construct() { $this->middleware('guest')->except('logout', 'userLogout'); } in AdminLoginController.php public function __construct() { $this->middleware('guest:admin')->except('logout'); } I'm sharing this because this is the part where my error is, but fixed when I didn't use the array in 'public function __construct() ' part in both controllers. Hope this will help you guys.
@spacingouty097 жыл бұрын
After login as custom user like admin, whenever I want to direct to other pages and call {{Auth::user()}} doesnt work
@jackwander6 жыл бұрын
Same problem here.
@yassinyoussoufali63246 жыл бұрын
We miss you 😭
@djebirihamza10987 жыл бұрын
hey ! i want use this methode {{ Auth::user()->name }} for 'admin' in welcome page so , Where and what should I change? thank's for your help ^^
@JacurtisTutorials7 жыл бұрын
Auth::guard('admin')->user()->name should do the trick
@djebirihamza10987 жыл бұрын
thanks alot for your help man it's working :D
@kylecastillon98735 жыл бұрын
alex ,I cant log out my admin user please help
@nidaakram51577 жыл бұрын
Hey i have a problem that is whenever I write wrong password it does not show me the message of wrong password instead of this it shows error under my username. Please tell me how to solve the problem
@mjackz7 жыл бұрын
Hi, to show a message of incorrect password in the admin/login page, you could add ->withErrors at AdminLoginController@login // if unsuccessful, then redirect back to the login with the form data return redirect()->back()->withInput($request->except('password'))->withErrors(['email' => trans('auth.failed')]);
@H11Hverse5 жыл бұрын
Great tutorial. I now Understand multi auth in laravel. I think the use of component is unnecessary in this part. you can only include the who.blade.php file.
@cromartie19847 жыл бұрын
can't logout of my admin, someone knows why ?
@goldenwings42306 жыл бұрын
user logout function its not working
@hmairihalim11626 жыл бұрын
try this without ->except() : $this->middleware('guest', ['except'=> ['logout','userlogout']]); work for me
@SJ-ev6qf7 жыл бұрын
DevMarketer i had problem with Auth::user(), its returning null
@yavuzkoca83527 жыл бұрын
To use it, you need to login first
@SJ-ev6qf7 жыл бұрын
Yavuz Koca i have logged in with admin bt while trying to upload a file i have to take the reference of user id but auth::user() is returning null also i have maked session to be remembered while logging in.
@yavuzkoca83527 жыл бұрын
Can u try this: Auth::guard('admin')->user()->name
@SJ-ev6qf7 жыл бұрын
Yavuz Koca solved not by your method hope your method would worked for me. By the way thanks for helping and responding to my problem.☺️
@JacurtisTutorials7 жыл бұрын
If it is returning null then it means a user is not logged in. You probably want to use Auth::check() to see if a user is logged in before you use Auth::user() or protect your route in middleware so only logged in users can see that page.
@Tuanna946 жыл бұрын
thanks you very much
@portesbruno7 жыл бұрын
very good
@LearnPHPaz6 жыл бұрын
Thank you !!!! :)
@trying2bepotatodeveloper8697 жыл бұрын
How to keep track of online users? :D
@syedanam11317 жыл бұрын
Attention please, when i logout as an admin user from Logout button. here also logout from normal user. that means, both users(admin & normal user) are logout by only one click.
@loremipsum5747 жыл бұрын
Same problem here.
@dankelly6 жыл бұрын
Where's part 5? 😁
@dankelly6 жыл бұрын
I found it... Had to search for the series. Thanks for the great videos! Super helpful!
@sparrow80737 жыл бұрын
thanks
@advikpatel70046 жыл бұрын
remember me not working properly.............please provide one tutorial for multiple authentication remember me
@PaoPaoPH7 жыл бұрын
ty
@ashburnett8915 жыл бұрын
I had some issues with the logout, and I also had issues with Remember Me, see how I fixed it here: github.com/DevMarketer/multiauth_tutorial/pull/28
@jacklindcosta67403 жыл бұрын
resources\views\layouts\app.blade.php For dynamic logout, means Logged user will get desired logout route replacing the default logout @if(Auth::check()==1) @if(Auth::guard('admin')->check()) {{ __('Logout Admin') }} @elseif(Auth::guard('web')->check()) {{ __('Logout User') }} @endif @else Not logged in @endif