我正在与一个现有的laravel项目合作。因此,在该项目上,上一个安装了两个auth文件夹,一个用于admin和client。现在,我的角色是添加卖方零件。我为卖方部分创建了分离的模型和控制器,但是当我尝试通过系统如何将卖方电子邮件搜索到客户数据库表中的任何方式使用卖方电子邮件和密码登录时。此代码用于我的卖家登录:
$credentials = $request->only('seller_email','seller_password');
if (Auth::attempt($credentials)){
return redirect()->intended(route('seller.dashboard'));
}
return redirect()->intended(route('seller.login'));
但是它搜索客户表为什么?
SQLSTATE [42S22]:找不到列:1054未知列'seller_email'在“ where子句”中(SQL:从
clients
中选择*,其中seller_email
[email protected]限制1);
Config / Auth.php文件看起来像
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'clients',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'api' => [
'driver' => 'jwt',
'provider' => 'clients',
],
'seller' => [
'driver' => 'session',
'provider' => 'sellers',
]
],
'providers' => [
'clients' => [
'driver' => 'eloquent',
'model' => App\Models\Client::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
'sellers' => [
'driver' => 'eloquent',
'model' => App\Seller::class,
]
],
尝试以]身份登录时,请使用卖方保护人员>
if (Auth::guard('seller')->attempt($credentials)){
return redirect()->intended(route('seller.dashboard'));
}