I use below function for insert/create new user from admin panel:
public function store(Request $request)
{
$this->validate($request, [
\'name
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
php composer.phar update
or
composer update
and fixed my issue easily.
I was facing the same problem, after debugging I found my smtp credentials was not working properly, email sending modules was not working that why I was getting this error, after fixing the credentials my code starts working properly and exception get disappear.
I suggest you to check your smtp credentials and make your you turn on less secure app setting.
Try this Hope it will help You
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|same:confirm-password'
]);
$insert_array = [
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password)
];
User::create($insert_array );
return redirect()->route('admin.pages.users.index')
->with('success','User created successfully');
}