Laravel framework allows us to manage database structures in a simple and straightforward way. Models in Laravel are of great help to manipulate database operations. To change the default user table. name, we can simply override the $table
property of a user model in Laravel.
Open your User.php file inside the app/Models directory. and find the $table
property. You can then replace the name with any other. table name of your choice. Consider the code snippet below.
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
protected $table = 'users_table';
}
You can then save the changes and use the php artisan commands below to reflect the change.
php artisan clear
php artisan cache:clear