I am creating website for a school and i am using laravel built in authentication to register new users, but i want add a field in the registration form for scratch card pin so it checks the pin table whether the pin is used or not.My problem is if create function inside authcontroller cant return a view.
So i got this error message
ErrorException in Guard.php line 430: Argument 1 passed to Illuminate\Auth\Guard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Http\RedirectResponse given
here is my authcontroller
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$spin=$data['pin'];
$pins = Pin::where('pin', $spin)
->get();
if( $pins[0]->status == 0)
{
Pin::where('pin', $spin)
->update(['status' => 1]);
return User::create([
'name' => $data['name'],
'username' => $data['username'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
else{
return redirect()->back();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire