laravel login as email code example
Example: login with email and phone laravel
protected function credentials(Request $request)
{
if(is_numeric($request->get('email'))){
return ['phone'=>$request->get('email'),'password'=>$request->get('password')];
}
elseif (filter_var($request->get('email'), FILTER_VALIDATE_EMAIL)) {
return ['email' => $request->get('email'), 'password'=>$request->get('password')];
}
return ['username' => $request->get('email'), 'password'=>$request->get('password')];
}