I have a registration form in my front page and the goal is to check if a user is already created, if a user already exists, show an error message that a user is already created with given values.
My RegisterController create method now looks like this:
public function create(Request $request) {
$create = User::create([
'email' => $request['email'],
'paypal_email' => $request['paypal_email'],
'password' => Hash::make($request['password']),
]);
if($create){
Company::create(['user_id' => $create->id]);
return redirect('/dashboard');
}
}
How to check if a user is already created and if yes, show an error message?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32wGAJ9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire