I'm getting the following error while registering in Laravel:
Type error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\users given, called in /home/procui74/procurementz/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php on line 35
Below is the create() function from my RegisterController.php file:
protected function create(array $data)
{
$userTypeId = user_types::where('userTypeTitle', $data['regTypeRadio'])
->pluck('userTypeId')
->first();
$user = users::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'isActive' => '0',
'isAdmin' => '0',
'userTypeId' => $userTypeId,
'contactPersonName' => $data['personName'],
'contactNumber' => $data['contactNumber'],
]);
$verifyUser = VerifyUser::create([
'users_id' => $user->id,
'token' => md5(uniqid(mt_rand(), true))
]);
Mail::to($user->email)->send(new VerifyMail($user));
return $user;
$notification = array(
'message' => 'Registration successful! Your account would be activated post verification.',
'alert-type' => 'info',
);
return redirect('/')->with($notification);
}
I understand that the error is due to this line: return $user;
but what to do not. I need the $user->id to save the user's id in the verifyUsers table.
This code works absolutely fine on my local machine (PHP 7.0.2.4) but doest work on web server (PHP 7.1).
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LM6ks1
via IFTTT
Aucun commentaire:
Enregistrer un commentaire