0

can I get some guidance on how I can extend Laravel's native authentication system to manage both admin and client roles while following SOLID principles?

Get an idea of how to implement solutions following SOLID principles For ex:

namespace App\Http\Controllers\Auth;

use Illuminate\Foundation\Auth\AuthenticatesUsers;

class AdminLoginController extends LoginController
{
    use AuthenticatesUsers;

    protected function username()
    {
        return 'email'; // Change the login field to "email" for admin users
    }

    // Add other methods as needed to customize the login process for admin users
}
udeshika
  • 1
  • 5
  • I think we may need more information on the structure of your app and what you're trying to achieve. If you have two separate systems for admin and client (e.g. an admin system and a storefront) then you may consider whether these should be two separate apps, or consider separate namespaces and separate user tables for each (e.g. users/customers, or admins/clients). If you have one system but a user can be an admin and/or a client then a single auth mechanism will likely suffice. – BlueC Mar 26 '23 at 20:35
  • It's course management sys Having admins / applicants / course teachers In one application need to manage all functions for each role Without creating multiple application I need to do a development in one application with spatie. – udeshika Mar 27 '23 at 18:37

0 Answers0