laravel 5.4 change authentication users table name

You can change the table name in the migration file and then change the table name variable in the User.php model.

Example:

class Flight extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'my_flights';
}

https://laravel.com/docs/5.4/eloquent#eloquent-model-conventions


You need just change in two places

1.add this line after hidden array of app/User.php

 protected $hidden = [
    'password', 'remember_token',
];

protected $table = 'another_table_name';

2.In the RegisterController change the table name in the validator method:

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|string|max:255',
        'email' => 'required|string|email|max:255|unique:another_table_name',
        'password' => 'required|string|min:6|confirmed',
    ]);
}