public function login(Request $request)
{
//Error messages
$messages = [
"email.required" => "Email is required",
"email.email" => "Email is not valid",
"email.exists" => "Email doesn't exists",
"password.required" => "Password is required",
"password.min" => "Password must be at least 6 characters"
];
// validate the form data
$validator = Validator::make($request->all(), [
'email' => 'required|email|exists:users,email',
'password' => 'required|min:6'
], $messages);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput();
} else {
// attempt to log
if (Auth::attempt(['approve' => '1', 'email' => $request->email, 'password' => $request->password ], $request->remember)) {
// if successful -> redirect forward
return redirect()->intended(route('user.overview'));
}
// if unsuccessful -> redirect back
return redirect()->back()->withInput($request->only('email', 'remember'))->withErrors([
'approve' => 'Wrong password or this account not approved yet.',
]);
}
}
Code Example |
---|
Php :: |
:: |
:: |
:: |
:: |
:: $e = array("red", "green", "blue"); echo intval($e) . "<br"; |
:: |
Php :: |
:: woocommerce coupon notifie a spefic email |
:: validate phone number with dial code laravel 8 |
Php :: laravel defining relationship |
Php :: |
Php :: how to add accept and decline button in php form |
Php :: upload laravel |
Php :: wp query compare like and or |
:: SQLSTATE[42S02]: Base table or view not found: 1146 Table many to many in laravel |
:: php preg_match html cross origin |
Php :: |
:: |
Php :: |
:: laravel gigapay update invoice |
:: |
Php :: |
Php :: phpstorm entity identification |
:: |
:: Date and time Asia karachi php |
:: |
Php :: |
Php :: PHP str_rot13 — Perform the rot13 transform on a string |
Php :: |