Laravel 5.2 auth change 'users' table Laravel 5.2 auth change 'users' table laravel laravel

Laravel 5.2 auth change 'users' table


To change table name go to app/User.php and set property $table to custom one for example:

$table = 'new_table';

You should also change default migration. Go to: /database/migrations/2014_10_12_000000_create_users_table.php file and change users here for the same name. To remove timestamps you can remove line:

$table->timestamps();

however if I were you I would reconsider removing those timestamps


DO NOT FORGET TO CHANGE VALIDATION IN REGISTERCONTOLLER.PHP AS WELL.

from

'email' => 'required|email|max:255|unique:users',

to

'email' => 'required|email|max:255|unique:company',


By default model take its class name as table name !
I define a protected property at the top of App/User.php

protected $table = 'auth_users';

This tells laravel to use auth_users table instead of default user table.and it works like charm.