Reputation: 504
I've got a weird problem with my laravel. I'm using the auth of laravel but I have a different DB. So I've changed the name of the table using protected $table = 'compte';
, but once I tryed something that required my table like login, it doesn't returned me an error except if I tryed to register a new user. With register, it gave me that it still use dbname.users
instead of dbname.compte
.
Here is what I changed in the User model :
protected $table = 'compte';
protected $primaryKey = 'id_compte';
public $timestamps = false;
// SET A DIFFERENT FIELD FOR THE PASSWORD DUE TO THE DB
public function getAuthPassword() {
return $this->mdp_compte;
}
Upvotes: 0
Views: 247
Reputation: 704
Change the table name to compte
in your config/auth.php
.
Also clear all caches by the command
php artisan cache:clear
.
Here is a default code
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
You need to change it
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Compte::class,
],
Upvotes: 2