Ashwin Sakthi Ashwin Sakthi - 23 days ago 7
PHP Question

how to validate email exists in database using luman while create new user?

how to validate email exists in database using luman while create new user?.

my registration controller code

$borrower = borrowerRegistration::create($request->all());
$last_borrower_id=DB::getPdo()->lastInsertId();
$store_borrower_array=array();
$store_borrower_array["borrower_id"]=$last_borrower_id;
$borrower_result = array('status' => 'true','message' =>'The First step borrower registration successfully.','content'=>array('registration'=>$store_borrower_array));
return json_encode($borrower_result);


please give a valuable suggestions.

Answer

You can try this way. here User is your Model (I am assuming)

if (User::where('email', '=', Input::get('email'))->exists()) {
   // user found
}

Replace Input::get('email') to your email address from where you are getting and storing it.