SC001 - Laravel 8 Multi Auth based on Roles

Поделиться
HTML-код
  • Опубликовано: 15 апр 2021
  • What Multiple auth system refers to? Well, as the name suggests, it is a terminology that refers to the process of login by multiple users based on roles in an application.
    In general, Authentication is the security process, and it indicates acknowledging the genuine user with proper account details.
    Here is the archetype of this tutorial, we will develop two users one is admin, and the other one is a regular user. Based on their roles, we will allow them to access in the app using middleware. Let us begin our work and start building our application.
    This time learn Laravel 8 multi authentication tutorial. You will learn how to create multi auth system in laravel using middleware.
    Multiple auth system means multiple users can log in to one application according to roles and use multiple pages.
    Multiple authentications are very important in the large application of laravel projects. Authentication is the process of recognizing user and admin credentials.
    Create a middleware for checking the user’s role in multiple authentications. It is an admin or normal user.
    Source code:
    github.com/Mbere250/Laravel-8...
    For more videos:
    - Integrate Admin Dashboard Template in project
    • SC002 - Integrate Admi...
  • ХоббиХобби

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

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

    Best vid on roles ever. really, all i see on youtube is that they use livewire and other auth models and templates . but this vid is the best.
    thanks for your efforts.

  • @mustafadundarcelebi1974
    @mustafadundarcelebi1974 3 года назад +4

    Very simply as possible, and clearly explained tutorial,
    thanks

  • @dwabuluka
    @dwabuluka Год назад +1

    Thank you very much. Worked like magic

  • @Defaulttt
    @Defaulttt 3 года назад +7

    FINALLY! I LOVE YOU MAN! THANK YOU FOR EVERYTHING YOU DID!

  • @siddharthrathod7608
    @siddharthrathod7608 3 года назад +2

    Great Work sir,
    Thank You!

  • @mohammedfalke2818
    @mohammedfalke2818 3 года назад +1

    Million Billion Likes For You and we can't Thank you As you Should For This Awesome Great Work. Thank you Again And Again . My greetings

  • @agungmaulana2849
    @agungmaulana2849 Год назад +1

    Omg you are a good tutor, i was totally dont know how laravel works and after i watch ur video im feeling more confident for my next assignment haha
    Thank you Mr Manzi
    Love from Indonesia

  • @albertabraham99
    @albertabraham99 2 года назад +2

    Thank you, Sir

  • @haaanaaa1245
    @haaanaaa1245 Год назад +1

    I love this one !!! One of the best ones !!! thanks for this one :)

  • @mdal-amin9762
    @mdal-amin9762 3 года назад +3

    Finally I have finished my task ,, Love you so much sir that i can not explain ,, I will pray for you , so that you always try to learn for us

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

      Wooow. Thank you so much

    • @mdal-amin9762
      @mdal-amin9762 3 года назад +2

      You are most welcome,,, sir,, your tutorial was much then better,, really apriciated,, ❤️❤️❤️❤️

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

      @@mdal-amin9762 Thank you.

  • @randzocampo
    @randzocampo 3 года назад +1

    Thank you!!!

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

    Awesome sir... Thanks.

  • @kennethkipchumba2532
    @kennethkipchumba2532 3 года назад +1

    Much Appreciated.

  • @keshavkumar9636
    @keshavkumar9636 3 года назад +1

    Very awesome explaining 👌

  • @shahriarsharar8363
    @shahriarsharar8363 3 года назад +1

    Sir, Your videos are best on internet , hope you will make an ecommerce project!

  • @LOMBOist
    @LOMBOist 2 года назад +1

    Thanks a lot Bro! You won a new subscription to your channel

  • @Ali-es8ee
    @Ali-es8ee 2 года назад

    thank you

  • @92kmusic
    @92kmusic Год назад +1

    supari bro

  • @abdulmujiburrohmanluthfi
    @abdulmujiburrohmanluthfi 2 года назад +1

    very nice. thank you very much

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

    Amazing content bro , keep it up ,

  • @muhammadtoseef6719
    @muhammadtoseef6719 3 года назад +1

    Great Job..!!

  • @marventhor285
    @marventhor285 3 года назад +1

    so clear and knowledgeable sir thank you so much

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

      thank you

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

      @@irebelibrary sir you have some adding and update and delete ?

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

      @@marventhor285 next videos we will see, Create, Retrieve, Update and Delete.
      Thank you.

    • @mohamedalsayed7552
      @mohamedalsayed7552 3 года назад +1

      Ali is a program that makes this beautiful sound

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

      @@mohamedalsayed7552 Yeah. Balabolka

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

    Great job.
    why didn't you use the laravel-permission?

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

    Thx

  • @jackodhiambo5710
    @jackodhiambo5710 2 года назад +1

    Is there a way to change roles in db,without interacting with the db directly?

  • @AhsanHabib-vt2dq
    @AhsanHabib-vt2dq 2 года назад +1

    tnx bro

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

    how to modify the dashboard (profile, settings) ? please help. the css files aren't loaded in the dashboard

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

    I love you tutorials Thank you very much
    cold you please add in the login checkbox remember that no working by me.

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

    i miss this guy.

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

    Cyakoze muranyemeje basaza,, thanks for tuto,, natwe twabikora... add more vids, congraturations @irebelibrary

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

      Urakoze cyane bro. ewana ndi kugerageza gukora cyane nshyiraho ama video meza.

  • @Razvanh29
    @Razvanh29 3 года назад +2

    Great work! Is there a written tutorial and/or Github repo?

  • @braynakossou9636
    @braynakossou9636 Год назад +1

    Hi 👋 Good Job. But I'm facing an issue.
    After Log in, when I'm on my dashboard, u can't access any other. It redirecting me automatically to dashboard.

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

    How to use ..user defined roles like
    Teacher and student,if role is teacher it will move to teacher dashboard and if role is student it will move to student dashboard?

  • @adityadwi369
    @adityadwi369 3 года назад +1

    Sir, can we change the boolean type data to int to auth based role? cause i already have the database and my type data for the role table is int not bolean. I try to follow your tutorial and when i check it out, it always return to login page and can't receive any data from my database. Sorry if my english is bad sir

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

      Hi Aditya. Yes it will work perfectly.

  • @Saboor-Hamedi
    @Saboor-Hamedi 2 года назад

    Mine is not working, after logged out I can go back to the dashboard, why is that ?

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

    Can I know how to put CRUD into it?....

  • @shahriarsharar8363
    @shahriarsharar8363 3 года назад +1

    sir, You made a video on seperate table (admin, doctor) multi auth... Can I use this process of role on those tables? would I have to be aware of anything or any change that time??

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

      You mean multi guards authentication but (admin/doctor) table have roles?.

    • @shahriarsharar8363
      @shahriarsharar8363 3 года назад +1

      @@irebelibrary yes sir, just on that tutorial I also want to add roles , like in admin table ,i want moderator , editor , super admin roles adding a field "role" in the table!

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

      @@shahriarsharar8363 I will try

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

      @@irebelibrary yes exactly

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

    Error : routing[admin.dashboard] not defined (this is my error)(solution?)

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

    Can I delete the home view as well as the HomeController, and create them without authentication, because I don't want it to be part of the views that need authentication. I hope its not a silly question, lol. Other than that, thank you for a wonderful tutorial.

    • @irebelibrary
      @irebelibrary  3 года назад +1

      Yes you can.

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

      @@irebelibrary Thank you very much.

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

    Sir make a video of comments section in laravel ajax based.

  •  3 года назад

    Let s go custom login with roles

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

    Man I need you, can you explain where the Auth::user() comes from? Is it automatically select the users table or what? Is it built in with laravel or it's because of make:auth command? Thanks man

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

      Hi Jannus Domingo. This comes after installing auth ui:
      laravel.com/docs/8.x/authentication#retrieving-the-authenticated-user

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

      @@irebelibrary but what is Auth::user() really does? Is it selecting the users table? Thanks for replying man

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

      @@jannusdomingo5681 yes it does select the user table that you create after intalling larevel auth:ui

    • @jannusdomingo5681
      @jannusdomingo5681 3 года назад +1

      @@rootnepal8793 thanks for the reply but Auth::user() doesn't need the auth command. I figured it out. Thanks man

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

    How I fix illegal offset type error

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

    can you teach a method directly going to admin when a admin logins , same for the user without updating the role id in databse

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

      After registration?

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

      Another method of admin and user registration without doing anything in role without updating in mysql

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

      @@manishdhungana331 You can achieve this by using Multi Guards Authentication.Check here ruclips.net/video/KBA22pSeoe4/видео.html

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

    If we are typing wrong password it doesnot redirect back to login.
    This code in the login controller is not working
    if (auth()->attempt(array('email' => $request->input('email'), 'password' => $request->input('password')))) {
    if (auth()->user()->role == 1) {
    return redirect()->route('adminDashboard')->with('success', 'Successfully logged In');
    } elseif (auth()->user()->role == 2) {
    return redirect()->route('userDashboard')->with('success', 'Successfully logged In');
    } else {
    return redirect()->route('login')->with('error', 'Incorrect Credentials');
    }
    }

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

    Route middleware group is not working.
    Where I'm logged in as admin then if I click browser back button then it redirects me to login screen.
    ============
    Route::middleware(['middleware' => 'preventBackHistory'])->group(function(){
    Auth::routes();
    });
    ============
    Anyway thanks. 👍

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

      Make sure that RedirectIfAuthenticated.php is correct.

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

      Here is the correc code:
      if(Auth::guard($guard)->check() && Auth::user()->role == 1){
      return redirect()->route('admin.dashboard');
      }
      elseif(Auth::guard($guard)->check() && Auth::user()->role == 2){
      return redirect()->route('user.dashboard');
      }

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

    where is role_user?

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

    Source code please..

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

      Source code:
      github.com/Mbere250/Laravel-8-multi-auth-based-on-Roles-with-examples