Auth Multi Roles Login with Custom Middleware in Laravel 9

Поділитися
Вставка
  • Опубліковано 21 жов 2024
  • In Laravel middleware will filter all http requests when there is client making request, for example we can find out which request is unauthorized and need to redirect to login page or to register page. The main purpose is to filter out unwanted request which is mostly apply to role and permission user.
    Today I will show you how to create custom middleware in multiple roles login.
    ✅ Article: www.cambotutor...
    ✅ Source Code • Laravel Custom Middlew...
    ✅QR Code Scanner Android • Implement Barcode QR S...
    ✅Android Support Multiple Language • How to Implement Andro...
    ✅Android In-App Review • Rating 5 Stars In-App ...
    ✅Android In-App Update • Android Show Update Av...
    ✅Convert Web to Android App • How to Convert Web to ...
    ==============Create Ads in Android===============
    ✅Admob Banner + Interstitial Ads • How to Show Banner Ads...
    ✅Android Native Ad with Exit Dialog • [From Scratch] How to ...
    ✅Android Native Ad in Recycler View • [From Scratch] How to ...
    ✅Android Native Template Ads in Activity • How to Add Native Ads ...
    ✅Android Playlist Admob Tutorial • How to Insert Banner, ...
    For more tips and quick code in programming development tutorials on the channel homepage...
    SUBSCRIBE www.youtube.co...
    Facebook - cambotu...
    ============================
    Music : UA-cam Audio Library
    Template Subscription : mixkit.co/
    #laravel9 #laravel_tutorial #middleware #authentication

КОМЕНТАРІ • 47

  • @me_lvin7068
    @me_lvin7068 Рік тому +4

    Great content. This is simpler and more understandable (especially for beginners) than any content I have already watched about user role authentication in Laravel 9.

  • @spade6774
    @spade6774 Рік тому +4

    for those have problem with webpack cli, you can actually just leave those part

  • @oktoniuszevanyasimanungkal9554
    @oktoniuszevanyasimanungkal9554 4 місяці тому

    Great Help! Thank you

  •  Рік тому

    webpack-cli] Error: Cannot find module 'C:\xampp\htdocs\onlineScholarshipSystem\webpack.mix'
    Require stack:
    i got this error sir, how can i solve this?

    • @CamboTutorial
      @CamboTutorial  Рік тому

      If you work on Laravel 9 WebKit not default in webpack, you have to modified

    •  Рік тому

      @@CamboTutorial how? 😅

    • @yandramuslim245
      @yandramuslim245 Рік тому

      @@CamboTutorial how to fix it sir?

    • @92kmusic
      @92kmusic Рік тому

      webpack.mix.js file another project copy and paste your page

  • @Nestumk
    @Nestumk Рік тому

    Great video! Guys, this error is fixed by the end of the video. if(Auth::check() && Auth::user->role == $role) Undefined constant Illuminate\Support\Facades\Auth::user

    • @hassannaveed7604
      @hassannaveed7604 Рік тому

      same i dont know something wrong with user may use if(Auth::check() && Auth:user()->role ==$ role)

  • @fatimahassan2673
    @fatimahassan2673 Рік тому +1

    Thanks for such great and simple tutorial 🌸 I am just asking about registration .. what are the steps to redirect each user to corresponding role page??

  • @ashrafulmomenshuvo5344
    @ashrafulmomenshuvo5344 Рік тому

    Awesome Bro... Amazing video!!!

  • @mexico4915
    @mexico4915 2 роки тому

    I like background white. Better like you did before.

  • @dhavalrathod-vh1ud
    @dhavalrathod-vh1ud Рік тому

    Best video for Multi login Very Help Full

  • @haidertoqeer
    @haidertoqeer Рік тому

    Thank you ❤❤ for uploading such a great tutorial

  • @スイートエッグ
    @スイートエッグ 2 роки тому

    tysm for the explanation, helps a lot ❤️

  • @vivekchavan4823
    @vivekchavan4823 Рік тому

    Thanks for video
    I use your code in my projects, but it take only one editor login. it is not refresing variables I am new to laravel please guide me

  • @ahmeddeghady4510
    @ahmeddeghady4510 Рік тому

    Thanks! When if I want to add extra attributes to a user based on the role? Say the customer may have extra attributes that an admin does not need (i.e. cart FK)?

  • @johnmichaelcagadas2563
    @johnmichaelcagadas2563 9 місяців тому

    I did not tried it yet but I think using this code if you are able tp login to the userpage you can also be able to redirect to admin using the routes

  • @darylpiamonte1612
    @darylpiamonte1612 Рік тому +2

    how about when registering it will redirect automatically in the response "You Don't have pwemission to access this page."

  • @lanceimam3535
    @lanceimam3535 Рік тому

    Is it okey not to include creating using scaffold? like I want to create auth manually?

  • @hassannaveed7604
    @hassannaveed7604 Рік тому

    Property 'role' not found in \Illuminate\Contracts\Auth\Authenticatable|null solution?

  • @hamzael-badaoui1736
    @hamzael-badaoui1736 Рік тому

    it give me this eror
    Too few arguments to function App\Http\Middleware\UserRoleMiddleware::handle(), 2 passed

  • @mexico4915
    @mexico4915 2 роки тому

    Thank you nice video!!!!! 🤗🤗🤗

  • @robertomejia3124
    @robertomejia3124 Рік тому

    Guys, following this video, I do not need to install Spaties/Laravel-Permissions, right ? I mean, could use this and it's almost the same

  • @eunicevlogs1584
    @eunicevlogs1584 Рік тому

    Hi, may I ask if this also work with laravel-react js?

  • @joshuaabejero9592
    @joshuaabejero9592 2 роки тому

    Just a quick question, you use role="0" not role="admin" how does it know it's admin? Sorry just new on this Laravel thingy.

  • @jrxsabre6419
    @jrxsabre6419 2 роки тому

    can we use enum instead of tinyInteger for role in database sir?

    • @CamboTutorial
      @CamboTutorial  2 роки тому +1

      yes, sure, but I prefer to use integer instead of enum.😀

  • @firassebai8592
    @firassebai8592 Рік тому

    how can i use those routes for my flutter

  • @hijrahdakwahid
    @hijrahdakwahid 2 роки тому

    when npm run dev, error on the webpack cli? what is the solution?

    • @CamboTutorial
      @CamboTutorial  2 роки тому

      Laravel 9 come with vite, I usually compile with webpack. Watch my video Laravel Enable Strong Password around 3:00 you can see I have configured that.

  • @lavishjain536
    @lavishjain536 Рік тому

    Hey i am getting the error Undefined array key "" .
    Help me to solve this problem

    • @kwenziwa
      @kwenziwa Рік тому

      same here buddy , did you get solution?

  • @armcahnnel
    @armcahnnel Рік тому

    you are awesome!!!

  • @VaibhavLonbale-x2u
    @VaibhavLonbale-x2u 8 місяців тому

    How can I get rid of this error "Vite manifest not found at: C:\xampp\htdocs\laravel-role\public\build/manifest.json".

  • @CodeNest256
    @CodeNest256 Рік тому

    Auth::user->role == $role (constant user not found) anybody to help?

    • @lanceimam3535
      @lanceimam3535 Рік тому

      use "user()" instead of user". you use wrong syntax

  • @skinnyfat6283
    @skinnyfat6283 Рік тому

    mantap bang

  • @abbosbekuz
    @abbosbekuz Рік тому

    good video