【发布时间】:2020-07-12 21:32:29
【问题描述】:
谁能解释一下为什么控制器部分会抛出错误?
这是我的模型:
class Suitspecialist extends Authenticatable
{
use Notifiable;
protected $guard = 'suitspecialist';
protected $fillable = [
'name', 'email', 'password',
];
protected $hidden = [
'password', 'remember_token',
];
}
控制器
这部分会抛出错误
将 [name] 添加到可填充属性以允许在 [App\Suitspecialist] 上进行批量分配。
protected function createSuitspecialist(Request $request)
{
$this->validator($request->all())->validate();
Suitspecialist::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
return redirect()->intended('login/suitspecialist');
}
【问题讨论】:
-
您可能需要清除缓存:运行
composer dump-autoload、composer clear-cache和php artisan cache:clear,甚至可能是php artisan route:clear。 -
我试过了,还是报同样的错误
-
删除
protected $guard = 'suitspecialist'试试 -
好的,只是为了确保:您在这个项目中只有 1 个 Suitspecialist 课程?它在 App 命名空间/文件夹下?
-
谢谢罗伯!我才发现
标签: laravel post get laravel-6