PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 1, 2022

[FIXED] How to use laravel default authentication in backpack

 February 01, 2022     authentication, laravel, laravel-5, laravel-backpack     No comments   

Issue

What I am doing:

I am doing a project in laravel using Backpack. In my project, there are two views. i.e. Admin view and Student view. Admin view is created using Backpack and the student view is created using auth. Admin uses the backpack's login and registration forms and routes while the student uses Laravel's auth's login and registration forms.

What I want to do:

So What I want is that I want to use Laravel's login forms and routes for logging into backpack dashboard as well and completely remove login and registration forms and routes of Backpack.

I am a newbie in laravel so maybe my question may be a little novice. How can I do that? Kindly guide me in this regard.


Solution

You can disable all of Backpack's auth routes in config/backpack/base.php:

    // Set this to false if you would like to use your own AuthController and PasswordController
    // (you then need to setup your auth routes manually in your routes.php file)
    'setup_auth_routes' => false,

And make Backpack use the default guard everywhere by setting this to null in the same file:

    // The guard that protects the Backpack admin panel.
    // If null, the config.auth.defaults.guard value will be used.
    'guard' => null,

You can then use your custom auth to login both users and admins.

But make sure you differentiate between users and admins in your app\Http\Middleware\CheckIfAdmin, you wouldn't want your students to have access to your admin panel.



Answered By - tabacitu
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing