注册表格后数组到字符串的对话错误

时间:2018-11-14 00:54:58

标签: php laravel

我正在创建新用户,它正在顺利进行,新用户会在DB表中弹出,但是在发送表单之后。 Page向我发送此错误。

  

ErrorException(E_NOTICE)数组到字符串的转换

用户模型

protected $table = 'users';

protected $fillable = [
    'name',
    'email',
    'password'
];

控制器

public function register(registerRequest $request)
{
    $request->flash();

    $request['password'] = bcrypt($request->password);

    $user = new User;
    $user->fill($request->all())->save();

    return view('auth.register')->withErrors($request);
}

知道为什么会这样吗?

1 个答案:

答案 0 :(得分:4)

您正在将请求对象传递给withErrors方法。

  

withErrors方法接受验证器,MessageBag或PHP数组。

Docs

相关问题