我正在尝试在UserController中创建新用户,但出现错误。在Google上找不到任何帮助。
我试图禁用验证器,但仍然收到相同的错误。
$user = User::create([
'name' => $name,
'phone' => $phone,
'email' => $email,
'password' => Hash::make($password),
'gym' => $gym,
'user_role' => $user_role,
'active' => $active
]);
“ message”:“ array_key_exists():第一个参数应为字符串或整数”, “ exception”:“ ErrorException”, “文件”:
答案 0 :(得分:0)
在我的情况下,此行中有错误
$attrs = Attribute::get();
$attribute_ids = $attrs->map->only(['id']); // solved
代替
$attrs = Attribute::get();
$attribute_ids = $attrs->get(['id']); // here was my error
我先替换
第二个无效
"message": "array_key_exists(): The first argument should be either a string or an integer", "exception": "ErrorException",