Change table users Auth Laravel 5.1

10

I'm developing a system using Laravel 5.1 and I do not want to use tables in English. Actually I'm trying to keep the standard here in the company.

I would like to know if I can use Auth or OAuth and change the table from users to users , and consequently their fields, for example: > password instead of password . In addition to adding more personal information and access levels.

Has anyone ever done anything like this?

    
asked by anonymous 13.08.2015 / 17:32

2 answers

2

First change the table name in config / auth.php :

'table' => 'users',

Add the variable $username to the file app / Http / Controllers /Auth/AuthController.php

protected $username = 'username';

To change the columns name , password , etc., you will need to create a new driver for auth. A common example is a LDAP driver where LDAP fields are different from those used by the framework.

    
15.09.2015 / 03:28
2

Yes.

In the app / auth.php file you have to change these two lines:

'model' => 'App\User',
'table' => 'users',

Change to the table name you created.

Remembering that the name of the table in the database should be in Plural and in Laravel the Model should be in Singular .

    
16.11.2015 / 12:07