Search code examples
laravellaravel-5authorizationlaravel-5.3laravel-authorization

Laravel authentication and authorisation


In my database, there is two table members and services. in that table, there are 5 column members Username, Rank, Name, Password, and more services username user_services

I don't want my default login from AUTH controller from users table but I want login from my members table and authorize table from another table services if user logins authentication from members table and authorize from services table

Tried everywhere but couldn't get any valuable answer. Thank You.


Solution

  • To change de auth table

    Edit app/config/auth.php to change the table.

    'table' => 'members',
    

    If you need to change field in app/Http/Controllers/Auth/LoginController.php

    public function username()
    {
        return 'yourField';
    }
    

    And you can continuos using AuthController from Laravel