I use below function for insert/create new user from admin panel:
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');
}
when I submit I get error as below :-
Trying to access array offset on value of type null
EDIT: I found my problem. my problem is email validation rule. when i remove email validation insert data is true.
How do can i fix this error !
Change Your Php version in Composer.json to 7.4.1 and run
composer update
This works for me
I have faced the same problem when I use laravel version 5.8.* and php version 7.4. I have solved this issue update composer. I just use this command in terminal
composer update
or
php composer.phar update
and fixed my issue easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With