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

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 360

  • @denisgusto
    @denisgusto 4 года назад +1

    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!

  • @Epsonworkforcewf7710
    @Epsonworkforcewf7710 7 лет назад

    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..

  • @dilmurod9820
    @dilmurod9820 2 года назад

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

  • @chrisdumezweni5125
    @chrisdumezweni5125 4 года назад

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

  • @worldtravelmonkey
    @worldtravelmonkey 7 лет назад

    @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!

  • @usmanghanee
    @usmanghanee 5 лет назад

    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!

  • @yiroyi2894
    @yiroyi2894 7 лет назад +2

    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 !

  • @shivanisehdev8817
    @shivanisehdev8817 7 лет назад

    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.

  • @_Java2016
    @_Java2016 6 лет назад

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

  • @joshijignesh7741
    @joshijignesh7741 6 лет назад

    Your teaching skill is super......Thank You man

  • @fear-h1r
    @fear-h1r 5 лет назад

    Watching this now, because former employee used this in 2 real projects and now I need to modify that projects. He linked me here.

  • @afolabibusari472
    @afolabibusari472 5 лет назад +2

    login page is unable to display . it shows error 'ReflectionException (-1)
    Class App\Http\Controllers\Auth\AdminController does not exist'
    please am using laravel 5.8.This tutorial is really indeed a great tutorial.keep it up Devmarketer

    • @juliansap1979
      @juliansap1979 5 лет назад

      i have the same problem did u already find a solution? because i didnt :(

    • @afolabibusari472
      @afolabibusari472 5 лет назад

      if you really want to create multi auth in laravel, you will need to copy your User.php file and rename it.follow these process:

  • @programmingtips6400
    @programmingtips6400 7 лет назад +7

    when i uncomment
    //$this->middleware('guest:admin'); in admin controller then it redirected to login page after login from admin login please help

  • @altafhossainlimon
    @altafhossainlimon 5 лет назад

    actually finding contentment in learning new cool multi auth functionality.

  • @darinelcigarroa5833
    @darinelcigarroa5833 4 года назад

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

  • @nashoshinoda8302
    @nashoshinoda8302 7 лет назад

    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!

  • @TedCelestin
    @TedCelestin 7 лет назад

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

  • @charlottepole2715
    @charlottepole2715 7 лет назад +1

    Hey, great tutorial! you explain everything really well,
    1) I do have minor problems though it seems to me a few other viewers have the same problem but it has not been answered.
    so when you are at admin/login then you enter your details for admin it should redirect to another page (admin.dashboard). instead it takes you back to the same page(login form), after troubleshooting abit even if you enter a wrong password it does not show any errors which is odd as the register page works fine and shows errors when one occurs.
    what would you do to fix these problems?
    2) I would like to use the admin table for admins to register themselves but after messing around i cannot find which bit to tweak to direct the register logic to admin table instead of the users one.
    Thanks

  • @niklaswennerstrand1010
    @niklaswennerstrand1010 7 лет назад +5

    It is super important to use throttling security for multiple login attempts for a website that is live on the internet. Bots are constantly searching for websites that the bots can use password rainbow lists and brute force to get in to your site. My suggestion is to never ever remove throttling features from Laravel. You must be meaning that you wont be creating the error pages and the user support for displaying timeout throttling messages etc. My guess is that you are focusing on creating the login part and not UI for throttling errors. I think its important that you make that clear to the viewer. Maybe put a little disclaimer box in the video.

    • @sarder2008
      @sarder2008 5 лет назад

      What is a throttling feature?

  • @OtarPorchxidze90
    @OtarPorchxidze90 4 года назад

    dude first video's link is incorrect, please correct it. you are owersome becouse explanation is fantastic

  • @biswanathbanik
    @biswanathbanik 4 года назад

    Thank you very much your video series help me a lot to make my project but you have used 5.x of laravel version and it also work in laravel 7 in my case thanks again

  • @TheErdibasak
    @TheErdibasak 5 лет назад

    Thank you so much, what a beneficial video. Note! In your video descriptions, Part 1's links are wrong. Thank you again.

  • @JD-hq1kn
    @JD-hq1kn 5 лет назад +1

    That creepy sound at 14:53 and that mysterious look following it.. LOL :)

  • @EliasNicolas07
    @EliasNicolas07 7 лет назад +1

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

  • @mevlutozdemir
    @mevlutozdemir 7 лет назад +2

    Hi,
    Great tutorial!! got my Multi Auth implemented. Just one question:
    How can I redirect the admin logout to the admin login page ?
    Thank you!

  • @IDStack
    @IDStack 7 лет назад +2

    Hi, I get an error when I want to logout as admin, then the admin site address is still accessible. What should I do ?

  • @RichardStovall
    @RichardStovall 7 лет назад

    Thank you for this series! Any idea when part 4 will be available?

  • @khalidmahmud1479
    @khalidmahmud1479 7 лет назад

    Your videos are helping me a lot. Thanks Man.

  • @scottjohnstone5314
    @scottjohnstone5314 6 лет назад

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

  • @exsitewebsolution6803
    @exsitewebsolution6803 7 лет назад

    this is immeasurably helpful. Thank you so much

  • @mraees4958
    @mraees4958 7 лет назад +15

    hi, the only problem i am facing is that it is not directing me to the 'admin dashboard' . Even with correct password ....? what should i do ? plz help soon

    • @Epsonworkforcewf7710
      @Epsonworkforcewf7710 7 лет назад

      Experiencing the same problem with laravel 5.3. Did you figure it out?

    • @Epsonworkforcewf7710
      @Epsonworkforcewf7710 7 лет назад +1

      Make sure the columns in the database are in small letters, the input names on your forms in small letters too, also make sure this matches the input fields in your controller. I did this and it worked for me.

    • @mahmoudahmed-di6wl
      @mahmoudahmed-di6wl 7 лет назад

      I have the same problem did you solve it ? @mark

    • @mraees4958
      @mraees4958 7 лет назад +2

      Yes , i have figured out the issue. the password must be encrypted and then save into your database. it should not be enter manually. Either use 'Tinker' to save username or password. or in your 'Controller' use this to save the password = $clinics->password = bcrypt($request->password);... $clinics is a object name ... password is a column name in my database and this line of code is bycypt($request->password) is where i am taking request from the textfield. hope this helps ! Good luck!!

    • @mahmoudahmed-di6wl
      @mahmoudahmed-di6wl 7 лет назад +2

      ok it is worked thanks @mark

  • @xseman
    @xseman 6 лет назад +2

    is it ok to use middleware in web.php?
    like Route::group(['prefix' => 'admin', 'middleware' => 'auth:admin'],function () {}
    I think its more clear than controller

  • @echorises
    @echorises 7 лет назад +3

    Hey! I have been following "How to build a blog" series, but using laravel 5.4. So when it comes to authentication parts (part 27) I decided to follow this tutorial instead because of the differences between the version that is used in that tutorial and version 5.4.
    So, right now doing everything in this video got me a
    "FatalThrowableError in AdminLoginController.php line 25:
    Class 'App\Http\Controllers\Auth\Auth' not found " error.
    What is causing this?

    • @echorises
      @echorises 7 лет назад +1

      Fixed it: Added "use Illuminate\Support\Facades\Auth;" in "AdminLoginController.php"

    • @moonlightteaa
      @moonlightteaa 7 лет назад +1

      thank you sir. you are very helpful!!!!

  • @SherMuhammadKhaan
    @SherMuhammadKhaan 7 лет назад

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

  • @asharekh
    @asharekh 7 лет назад

    Hi,
    thanks allot for your time and marvelous channel.
    looked everywhere on how modal login will work with Laravel, but not success. hope that you cover or guide this area.

  • @magegam1
    @magegam1 4 года назад

    Hi Great tutorial!! got my Multi Auth implemented

  • @FitWithMohitSingh
    @FitWithMohitSingh 7 лет назад

    Hi, Your video is very helpful the only problem i found is, when accessing /admin without login, it is redirecting me to /login page. It should login to /admin/login ..... hope you understand my concern and will get your answer soon.

  • @viveksah2069
    @viveksah2069 7 лет назад

    i love your video i get all the time what i need nothing more fancy which make confusion...

  • @sanderweide6245
    @sanderweide6245 4 года назад

    Thank you for helping me get my degree :)

  • @MarkyMark_
    @MarkyMark_ 7 лет назад

    Hey Alex, learning the most from your videos. Just letting you know the video link for part 1 is incorrect, it's directing to part 2.

  • @lady3286
    @lady3286 4 года назад

    Thank you so much great tutorial helps me a lot

  • @ЕвгенийД-я9ц
    @ЕвгенийД-я9ц 4 года назад

    Friend, I would give you more likes if it could be done. Very cool and useful video!

  • @batmanbatmann
    @batmanbatmann 6 лет назад

    Thanks a lot for share your skills with us
    The force will be with you

  • @anilthakur4289
    @anilthakur4289 7 лет назад

    great work! thank you. Can you please create written or video tutorial for complete e-commerce project.

  • @glubglub4421
    @glubglub4421 4 года назад

    32:15 btw thanks for this video its really helpful.

  • @dela__a
    @dela__a 6 лет назад +1

    @DevMarketer so i needed to implement this on my final year project at school and i happened to find this.
    now, everything works from part one but in part two when in input the credentials for the admin, it redirects me back to the adminlogin page. some people had these erros. was the a solutions or can you help me put here?

  • @adelekedavid4330
    @adelekedavid4330 7 лет назад

    Excellent..... You just made my day

  • @2oome
    @2oome 7 лет назад

    Hi There, I have got multi auth working thanks to this tutorial. Access, however, seems to be a bit of a problem. I have a controller that needs to be guarded by both, user and admin, meaning that only these types of users can access this controller, but every time I use one guard in __construct(), the other cannot access it. I even tried $this->middleware(['auth','auth:admin']) and both types got blocked from accessing this controller. Thank you already for this great series.

  • @NazrulIslam-iz6sw
    @NazrulIslam-iz6sw 5 лет назад

    why we using 2 different routes for 2 types of login??
    we should have the same routes for login for both user and admin.
    while checking data from database, we should check from both table & based on that we will divide either as user or admin.
    How to do this?

  • @sadiqnoor6803
    @sadiqnoor6803 5 лет назад

    thanks, boss I was looking exactly like that it's working for me in front end and admin both in laravel 5.7

    • @quasarfc3133
      @quasarfc3133 5 лет назад

      it works in the part of validating the login fields?

  • @AlexCrocker
    @AlexCrocker 7 лет назад +8

    This is SO helpful! Thank you.

  • @michaelyara2975
    @michaelyara2975 7 лет назад

    I love you men, muchas gracias por fin pude solucionar el problema del logueo con otro usuario

  • @sowmyavejerla
    @sowmyavejerla 7 лет назад +2

    hello...may I know how to differentiate admin and user registration.when I register it is saving into user table but not admin table based on your tutorial.

  • @alfincandra2028
    @alfincandra2028 7 лет назад

    For people who face the error Auth::guard
    please check the middleware of construct
    make sure guest:admin not guest::admin
    Because, i faced it too.

  • @JohnAwalitravels
    @JohnAwalitravels 4 года назад

    AuthenticatesUsers.php file not appearing Laravel Framework 7.7.1 (vendor/larvel/framework/src-illuminate/foundation/auth/AuthenticatesUsers.php file not appearing) please advice.

  • @bihmaxx166
    @bihmaxx166 4 года назад

    Whats weird is that if i log in as admin it lets me log in again with the user login and after those 2 login form it routes me to admin dashboard

  • @yuujikyoutsuke1322
    @yuujikyoutsuke1322 6 лет назад

    i thought this was part 1 no wonder why i feel like missing something, this is part 2 of the series -_-

  • @Cybersix6666
    @Cybersix6666 6 лет назад

    Can you give an array of middle to your controller so Admin can access user dashboard too ?
    Thanks

  • @muhammadainulhassan6128
    @muhammadainulhassan6128 6 лет назад

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

  • @mathishuttl5654
    @mathishuttl5654 7 лет назад

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

  • @kritikashr
    @kritikashr 6 лет назад

    Hi. This is really good and helpful. Can you please explain how can I implement validation for admin login form? As the error message is not displayed when wrong credentials are entered.

    • @perfect.stealth
      @perfect.stealth 5 лет назад

      Any luck on this? been searching without any luck..

  • @EhsanCh07
    @EhsanCh07 5 лет назад

    Hey Dev how are you. Dev i am unable to verify credentials, every single time it returns back to admin login page. If(Auth...) not working at all. I've checkd and go through my code again and agiain but can't find an issue. Please guide.

  • @mutasimfuad9967
    @mutasimfuad9967 7 лет назад

    It seems for me may be the admin guard is not caught in the handler class so it is not authenticating me as admin instead it lets me go forward with the request and show the admin dashboard page.

  • @bigsgm
    @bigsgm 6 лет назад

    your video is awesome!. hello from Japan!!

  • @samueladegunle715
    @samueladegunle715 6 лет назад

    Very good tutorial. Thank you

  • @pervezQadir
    @pervezQadir 7 лет назад

    when password resets are coming?
    very awesome tutorial Alex.. thank you..
    please make a video on multi role users.. please.. or extend this series... thank you.

  • @mamunurraja5670
    @mamunurraja5670 3 года назад

    It says app/models/Admin models not found in laravel 8. can you help me?

  • @adnanjam
    @adnanjam 7 лет назад

    whats the difference between using auth middleware in the routes grouping and in the controller? I personally prefer it in the routes list

  • @biswajitmaity3659
    @biswajitmaity3659 4 года назад

    Many thanks sir.

  • @lamierdaboys8936
    @lamierdaboys8936 4 года назад

    Hiii i need your help. It say's undefined variable index after i click login

  • @soultouchingsongs
    @soultouchingsongs 7 лет назад

    Firstly thank you so much. I have a query. Tinker gives error 'Class 'Illuminate\Foundation\Auth\Admin' not found' when I try to create a new admin as you did. So, I had to create an Admin class similar to User class in this directory. Then it works. Is this the correct way?? Please help.

  • @Bosbay6902
    @Bosbay6902 6 лет назад

    need some help here at your video 10:26 for the file AdminLoginController 'use Illuminate\Http\Request;' i get a message 'import illuminate http request is never used' so when i execute my code i get some error message as they can't use $request my laravel version 5.7

  • @jabbergabber5190
    @jabbergabber5190 7 лет назад

    Hi - Fantastic series by the way. Thank you.
    I am following the tutorial but I am getting 'undefined class Auth' when I use ...
    namespace App\Http\Controllers\Auth;
    use Illuminate\Http\Request;
    use App\Http\Controllers\Controller;
    use Auth;
    ---------
    Any ideas what I am doing wrong ?

    • @jabbergabber5190
      @jabbergabber5190 7 лет назад

      I've used Illuminate\Support\Facades\Auth and it seems ok.
      What has changed since your tutorial or what did I do wrong?

  • @descongestionante_nasal
    @descongestionante_nasal 5 лет назад +1

    Thank you so much for sharing!

  • @PortgasDRoy
    @PortgasDRoy 5 лет назад

    Very informative! Hats off

  • @firojkhan-kv1ew
    @firojkhan-kv1ew 6 лет назад

    sir getting this error
    The Response content must be a string or object implementing __toString(), "boolean" given.
    how it will solved

  • @vincelouiechu6702
    @vincelouiechu6702 7 лет назад

    Hello. Why can I still go to admin dashboard even if I logout the admin account? Thanks for the answer.

  • @ifrashable
    @ifrashable 6 лет назад +2

    why is this not working ?
    Auth::guard('admin')->attempt(...................) // admin using passport as the driver

    • @thaddeusokafor2953
      @thaddeusokafor2953 6 лет назад

      go to config/auth.php and make sure you set your admin guard driver to session and not token, Hope it helps

  • @shakilmahmud829
    @shakilmahmud829 6 лет назад

    Thank you for your helpful content

  • @kabirabiodun5617
    @kabirabiodun5617 6 лет назад

    very interesting tutorial very helpful

  • @aniszulaikha8953
    @aniszulaikha8953 Год назад

    I need help, when I login as admin, it does not displays the admin name on the top nav bar. Can someone help. Thanks

  • @karlmorisset5299
    @karlmorisset5299 6 лет назад

    I know it's an old video, but I have a question Alex : I can't log 2 different types of users in the same time. When I'm loggued in with an admin, as soon as I try to log with a customer, the admin is loggued out. Do you have any lead (maybe you've faced the problem at one point) of the issue ? Thanks (you do awesome videos!)

  • @metal_addict92
    @metal_addict92 7 лет назад +1

    hi, how can I get the name column in Admin?, because with user is:
    $user = Auth::user()->name;
    thanks in advance

  • @james917
    @james917 7 лет назад

    SO I am following the steps you created for an admin, I need our admins to login with two different numbers. an employee number and department number. We are not using passwords. i was able to get setup correctly I am testing it out now but the when I add the department number it does not re direct to the dashboard it just jumps and stays on the login. Is there a step I am missing?

  • @kpopfans7246
    @kpopfans7246 3 года назад

    Thank uu man ur tuto helped me a lot thankss

  • @Mike-iw4zc
    @Mike-iw4zc 7 лет назад

    Thank you so much, a very nice video.

  • @TheMuhammadshoaib
    @TheMuhammadshoaib 4 года назад

    Sir how to get multi auth user data. For example if user a is login then get user a id from Auth::user()->id. So on if login b user get this user data.

  • @husnithamrin4249
    @husnithamrin4249 7 лет назад

    i stopped at 7:05 and confused, the architecture already diffrent, LOL, i think laravel updated again, i'm in laravel 5.4 (17-may-2017) they have more folder inside /illuminate/Auth/ and diffrent naming and code as well, so i will watch your video and clone your github, thx for made this video

  • @nutanpanta9238
    @nutanpanta9238 4 года назад

    I completed till this video everything had worked until at the end when i login as admin even if i enter valid credentials that redirect back command is executed and to rule out the possiblity that i did some mistake i again made new laravel project and again watched the video and did it still the same thing happened. can someone tell me what is the problem and how i can fix this.

  • @maurobonucci1723
    @maurobonucci1723 7 лет назад +2

    All of this is nice, but woudnt be just easyer on the LoginAdminController simply call a method guard from the AuthenticatesUsers controller and set it to the 'admin'
    /**
    * Get the guard to be used during authentication.
    *
    * @return \Illuminate\Contracts\Auth\StatefulGuard
    */
    protected function guard()
    {
    return Auth::guard('admin');
    }

    • @lifeinloop
      @lifeinloop 5 лет назад

      ~Hi Mauro. I'm not able to login in with this code on the admin login. It seems it fails the login becaus i get redirected to the admin login page with the email data. So that autentication is not successeful i don't know why. How can i implement your solution?

  • @johnanthony811
    @johnanthony811 7 лет назад

    hi i had follow this video... but i face that some problem. how can create Admins table in phpmyadmin
    ...?

  • @jacklindcosta6740
    @jacklindcosta6740 3 года назад

    Excellent! Also work with laravel 6

  • @Poonam-gu5zc
    @Poonam-gu5zc 5 лет назад

    I got this error when login to admin "Argument 1 passed to App\Http\Controllers\Controller::validate() must be an instance of Illuminate\Http\Request, string given, called in C:\xampp\htdocs\multiauth\app\Http\Controllers\Auth\AdminLoginController.php

  • @shiropanderz
    @shiropanderz 6 лет назад

    Hi, how to you configuring throttle in admin login?

  • @yccodei
    @yccodei 7 лет назад

    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

  • @Slinece96
    @Slinece96 5 лет назад

    why should i create an admin table, just for one admin account. I'll go for role based logged in using "users" and "role"

  • @talebg
    @talebg 6 лет назад

    Hey, Alex. Nice tutorial, but I'm wondering why are you copying just a part of AuthenticateUsers trait when you can use it in your AdminLoginController and just add the guard() method that specifies the guard against which you want to log the user (well, admin in this case) in? It's just one method call and you get all the goodies the trait comes with... I did it that way and it works. Any ideas if this is wrong on my side?

    • @love41412
      @love41412 5 лет назад

      Yes i changed my code too at the end, but i think it is good also the way he showed it to us. Personally it helped me to understand some behind the scenes stuff better.

  • @saqibziatv
    @saqibziatv 7 лет назад

    Hi I am using Laravel 5.5 when i use ($this->middleware('guest:student');
    ) in AdminLoginController it doesnot allow me to go to localhost:8000/admin/login instead of that it shows me no page found i have defined route for this but it is not working.Can Any one tell me the fix !! By the way when i remove $this->middleware line it allows me to go to localhost/admin/login!!

  • @hieuluong5984
    @hieuluong5984 7 лет назад

    Hi , after the login i can get user info from auth: auth()->guard('admin')->user(). But when i redirect any page, It seems that it has not been logged. I checked Auth::check() - result is false

  • @bernardchisumo4054
    @bernardchisumo4054 7 лет назад

    Hi DevMarketer
    Can you please share the handout for these videos please