login with email and phone laravel

Solutions on MaxInterview for login with email and phone laravel by the best coders in the world

showing results for - "login with email and phone laravel"
Pia
10 Jan 2020
1<?php
2
3namespace App\Http\Controllers\Auth;
4
5use App\Http\Controllers\Controller;
6use App\Providers\RouteServiceProvider;
7use Illuminate\Foundation\Auth\AuthenticatesUsers;
8use Illuminate\Http\Request;
9use Illuminate\Validation\ValidationException;
10
11class LoginController extends Controller
12{
13    /*
14    |--------------------------------------------------------------------------
15    | Login Controller
16    |--------------------------------------------------------------------------
17    |
18    | This controller handles authenticating users for the application and
19    | redirecting them to your home screen. The controller uses a trait
20    | to conveniently provide its functionality to your applications.
21    |
22    */
23
24    use AuthenticatesUsers;
25
26    /**
27     * Where to redirect users after login.
28     *
29     * @var string
30     */
31    protected $redirectTo = RouteServiceProvider::HOME;
32
33    /**
34     * Create a new controller instance.
35     *
36     * @return void
37     */
38    public function __construct()
39    {
40        $this->middleware('guest')->except('logout');
41    }
42
43    /**
44     * Get the failed login response instance.
45     *
46     * @param  \Illuminate\Http\Request  $request
47     * @return \Symfony\Component\HttpFoundation\Response
48     *
49     * @throws \Illuminate\Validation\ValidationException
50     */
51    protected function sendFailedLoginResponse(Request $request)
52    {
53        throw ValidationException::withMessages([
54            'username' => [trans('auth.failed')],
55        ]);
56    }
57
58    /**
59     * Get the login username to be used by the controller.
60     *
61     * @return string
62     */
63    public function username()
64    {
65        $login = request()->input('username');
66
67        if(is_numeric($login)){
68            $field = 'phone';
69        } elseif (filter_var($login, FILTER_VALIDATE_EMAIL)) {
70            $field = 'email';
71        } else {
72            $field = 'username';
73        }
74
75        request()->merge([$field => $login]);
76
77        return $field;
78    }
79}
80
81
Sofia
19 Apr 2018
1protected function credentials(Request $request)
2        {
3          if(is_numeric($request->get('email'))){
4            return ['phone'=>$request->get('email'),'password'=>$request->get('password')];
5          }
6          elseif (filter_var($request->get('email'), FILTER_VALIDATE_EMAIL)) {
7            return ['email' => $request->get('email'), 'password'=>$request->get('password')];
8          }
9          return ['username' => $request->get('email'), 'password'=>$request->get('password')];
10        }
queries leading to this page
email or phone login laraveluse phone instead of email laravel authlaravel change auth form email to phonelaravel auth login through email and numberauth attempt laravel email or phone numberlogin with email otp in laravellaravel change auth from email to phone numberlaravel mobile as login instead of emaillaravel authentication tutorial email to phoneauth login using email or phone laravelllogin with phone number instead of email laravellaravel login with phone or emailhow to check in registercontroller phone number uniquelaravel ccheck email or mobile numberlogin with username or phone or email in laravellaravel email phonecustome check auth attempt using email or phone number and password in laravelmake login with email only laravellaravel make default auth with phone not emaillarvel login by email or mobilelogin with email or phone number in laravellogin using phone number auth laraveluse mobile number or email to login laravellogin with phone number and email laravellaravel login with only contact numberlogin with email or phone number laravel 7 24credentials 3d email or phone validationlaravel auth login through email or numbercheck auth attempt using email or phone number and password in laravellaravel login with phone emaillaravel login with aither email or mobilelaravel login with mobile or emailhow to auth via mobile number in laravelauthenticate user with email and phone number laravellogin with email or phone number laravel 8laravel auth change email to phone for loginlaravel login with email or phoneemail verify laravelhow to find use with email 2f phone in laravellaravel validae is email or mobilelogin with phone and email in laravellaravel auth login examplelaravel login using link emaillaravel 8 login with email or phonehow to change login from email to phone number in laravelcheck mobile or email in laravellaravel auth login with phonelaravel auth chenge email to phonelogin with phone number instead of email in laravel 8login using either username or email or phone laravelhow to authenicationfrom email to phone auth 3a 3aattempt in laravellaravel login via phone instead of emailuse auth 28 29 3eattempt 28 29 to login with email or phone number laravellogin with email or phone number laravel with validationhow to login with phone and email in laravellaravel validation check mobile or email laravel auth login form mobile numberlaravel auth attempt phone number and passwordlaravel verify email or phonehow login with email or phone number in one field in laravellaravel change auth email to mobile numberhow to change email to phone number in laravel authemail or phone login laravel oauth 2ftokensend email or mobile in laravel 8laravel change auth email to mobile number loginlaravel login with mobile number or emaillogin with mobile number or email laravellogin with email or phone number laravellaravel auth login with phone or email phone or email for authentication laravellogin with email and phone laravellaravel login phone number or emaillaravel make email not uniquelaravel how to login user with phone numberlaravel login with email or phoneuser login with mail 26 mobile in laravel 7laravel login using both email and phonelaravel how to login user with phone number in authlogin with email or phone number laravel apilogin with email and phone laravel