在Laravel应用中使用Cartalyst Sentinel注册

时间:2019-06-24 05:24:33

标签: laravel cartalyst-sentinel

所以基本上我想在我的laravel应用中使用哨兵库实现注册功能。 我一直在关注官方文档,当我尝试存储数据时,我遇到了类似的错误

TypeError: Argument 1 passed to Cartalyst\Sentinel\Users\EloquentUser::setPermissionsAttribute() must be of the type array, string given, called in C:\xampp\htdocs\level\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasAttributes.php on line 617 and defined in 

我试图找出问题所在,但仍然陷于困境

这是我的控制器代码

    try {
                //code...
                // dd($credentials);
                $user = Sentinel::register([
                    'email' => $request->email,
                    'password' => Hash::make($request->password),
                    'permissions'=> $request->roles,
                    'first_name' => $request->nama
                ]);
                return redirect('/register')->with('success','Account waiting for approval');

            } catch (\Throwable $th) {
                //throw $th;
                echo $th;
            }

0 个答案:

没有答案