我使用以下功能从管理面板插入/创建新用户:
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|same:confirm-password'
]);
$input = $request->all();
$input['password'] = Hash::make($input['password']);
User::create($input);
return redirect()->route('admin.pages.users.index')
->with('success','User created successfully');
}
当我提交时,我收到如下错误:-
Trying to access array offset on value of type null
编辑:
我发现了我的问题。我的问题是电子邮件验证规则。当我删除电子邮件验证插入数据是真的。
我该如何解决这个错误!
最佳答案
将 Composer.json 中的您的 PHP 版本更改为 7.4.1 并运行
composer update
这对我有用
关于php - 错误 "Trying to access array offset on value of type null"laravel 5.8.26 Php 7.4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60188713/