我有 用户 表,其中包含作为主键的用户ID,但在使用用户身份验证时 “用户。user\u UserId” 那么,我如何从主键中删除“user\uux”前缀呢?
型号:
class User extends Authenticatable { use Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $table = 'Users'; protected $primaryKey = 'UserId'; }
在配置/身份验证中。提供程序数组中的php在第73行取消对用户的注释。
'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], 'users' => [ 'driver' => 'database', 'table' => 'users', ], ],