How to change user table in laravel?

Member

by lily , in category: PHP Frameworks , a year ago

How to change user table in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by herminia_bruen , a year ago

@lily 

To change the user table in Laravel, you can follow these steps:

  1. Open the config/auth.php file.
  2. Inside the providers array, locate the users provider and update the table property with the new table name. For example: 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => AppUser::class, 'table' => 'your_new_table_name', ], ],
  3. Open the app/User.php file (or the file that contains your User model).
  4. Update the protected $table property with the new table name. For example: protected $table = 'your_new_table_name';
  5. Run the database migrations to reflect the changes: php artisan migrate This will update the table name in the database.


That's it! Laravel will now use the new table name specified in the configuration and model.

Related Threads:

How to connect 3 table with a pivot table in laravel?
How to revoke alter table permission from user in oracle?
How to change the password of a user in phpMyAdmin?
How to find user by user name in laravel?
How to change committed user name in bitbucket?
How to change alignment of each cell in html table?