(Part 2) Logging In Multiple Users - Native Multi Auth in Laravel 5.4

preview_player
Показать описание
The previous video we set up multiple authentication guards and multiple authentication models natively in Laravel 5.4. Everything works well and our middleware is already protecting our pages. But now we need to let users log in. We already have access to the normal user's login page. But the problem is we don't have a way to let our Admins log in.

In this video I will show you how to create a LoginController for our Admins to manage their login functionality. We are also going to make a login form, by simply duplicating the form that Users already have, but for your app you might want to make a custom login form for each user and you can do that here in your views.

For the most part this video will be pretty straightforward for advanced Laravel devs. I recommend skipping this video if you don't feel like you need it.

One challenging part might be how to log the user in. In this section of the controller we use the Auth::attempt function to log the user in using the native Laravel Auth facade.

If you have any questions, leave a comment below.

------ WRITTEN TUTORIAL: (Coming Soon)

===========================================
=== Multiple Authentication in Laravel 5.4 Series: ===
===========================================
Part 1: Setting up our Models and Auth Guards

Part 2: Creating Login Pages and Logging in Users

Part 3: Modifying Middleware to Support Multiple Users

Part 4: Forgot My Password Functionality across Multiple User Types
Coming Soon.

==== DOWNLOAD SOURCE CODE ====

Download from GitHub:

==== FOLLOW ME ====

Subscribe to DevMarketer Insider

(ask me questions!)

==== QUESTIONS? ====

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Thanks for all your support!

_________
Laravel 5.4 Authentication Multiple User Models One Application. Best tutorial authentication laravel help. Laravel 5.3 Muliple Authentication. No Packages. Laravel Php code tutorial video post example. Store user admins. Multiauth tutorial. Login form. Login function. Auth facade. Auth attempt laravel function.
Рекомендации по теме
Комментарии
Автор

Been struggling with Admin authentication for days until I found this lesson. Thanks so much!!

chrisdumezweni
Автор

Thank you very much for these tutorials about multi-auth. You made the most straight forward and easy to understand tutorials on this topic and I have seen many. Your way of explaining things is very good and you are definitely well prepared!

usmanghanee
Автор

Clear. Professional. Perfect. You're my first choice for Laravel.

_Java
Автор

I almost lost hope implementing multi auth in laravel, clutching at bogus tutorials and hitting dead ends until I saw this tutorial and everything changed. Thank you Alex, keep up the good work..

Epsonworkforcewf
Автор

Hey You are awesome. The way you explained everything makes understanding so easy. Thanks for creating such helpful series.I have gone through number of other tutorials but finally i found you the best.

shivanisehdev
Автор

I'm just learning Laravel, and this tutorial was very useful to learn how to make a good login and then implemented in on my app ^.^, Greetings from Mexico !

yiroyi
Автор

I am a programmer from Brazil and even though i am not fluent i can understand the content perfectly!
You are too much a teacher! <3

denisgusto
Автор

Thank you, that was just what I needed. Awesome, keep up the vids!

scottjohnstone
Автор

Thank you very much you are one of the best teacher and laravel programmer in the world man

dilmurod
Автор

@DevMarketer thank you very much for this walk through. Very informative and professionally done. I just wanted to add my 2 cents after struggling with custom multiple auth controllers, guards and middleware. I believe it is important to avoid overriding built-in Laravel functionality where possible, from many reasons but the most important one is to that you minimize the risk that your authentication will break in future versions . I've found that Instead of re-creating the whole login method inside the controller (which is inherited from the `AuthenticatesUsers` trait), it's easier to add a `guard` method to the custom login Controller that returns `Auth::guard('admin')`- this assumes that the credentials field names are the same of course. This way we use the build in login method and if it ever gets changed in the framework nothing breaks (my project starts as early as Laravel 4 an I saw way too many changes to the authentication methods). Hope it makes sense and helps someone. Keep up the good work!

theblackboxil
Автор

Thank you. Your first video made me realize of something. :)

EliasNicolas
Автор

Really good video. I would recommend to anyone trying to learn more about laravel login in general.

TedCelestin
Автор

this is immeasurably helpful. Thank you so much

exsitewebsolution
Автор

Man, cool videos! I was looking to this kind of tutorial like 3 weeks! I'm nooby with laravel so this will be so useful to me.

By the way, I noticed you used to get some files going through the files. I think you're using Sublime so you can hint CTRL+P and type the file you are looking for. That could be save you a few seconds on your videos.

Keep working like this, man! You're going great!

nashoshinoda
Автор

Your videos are helping me a lot. Thanks Man.

khalidmahmud
Автор

perfecto, no hablo ingles y entiendo muy bien lo que transmites, excelente!

darinelcigarroa
Автор

actually finding contentment in learning new cool multi auth functionality.

altafhossainlimon
Автор

Thank you sir... Very helpful tutorial.. exactly what i was looking for

SherMuhammadKhaan
Автор

dude, you are awesome .. I really appreciate you efforts .. thanks

muhammadainulhassan
Автор

such a nice tutorial!!! subbed! keep it up lad

mathishuttl