Open sidebar
public function index( Request $request ) { $email = Input::get('login_username'); $password = Input::get('login_pass'); $response['status'] = 'fail'; if( empty( $email )){ $response['message'] = 'Email is Empty'; } else if( empty( $password )){ $response['message'] = 'Password is Empty'; } else if (Auth::attempt(['email' => $email, 'password' => $password] )) { $user = User::where('email' , '=' , $email )->get()->first(); //Auth::loginUsingId( $user->id ); if (Auth::check()) { $response['status'] = 'success'; $response['id'] = $user->id; $response['token'] = csrf_token(); } else { $response['message'] = 'Error while loging in'; } } else { $response['message'] = 'Email or Password is wrong'; } echo json_encode($response); exit; }
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting