我有用户表,其中包含UserId作为主键,但当我用户身份验证时,它使用" Users.user_UserId" 那么如何删除" user _"来自主键的前缀?
型号:
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'Users';
protected $primaryKey = 'UserId';
}
答案 0 :(得分:1)
在提供者数组中的config / auth.php中,取消注释第73行的用户。
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
'users' => [
'driver' => 'database',
'table' => 'users',
],
],