app/Http/Controllers/AuthController.php
/**
     * Login user and return a token
     */
Login user and return a token
Login user and return a token
public function login(Request $request)
    {
        $credentials = $request->only('email', 'password');
        if ($token = $this->guard()->attempt($credentials)) {
            return $this->respondWithToken($token);
        }
        return response()->json(['error' => 'login_error'], 401);
    }
public function login ( Request $ request ) { $ credentials = $ request -> only ( 'email' , 'password' ) ; if ( $ token = $ this -> guard ( ) -> attempt ( $ credentials ) ) { return $ this -> respondWithToken ( $ token ) ; } return response ( ) -> json ( [ 'error' => 'login_error' ] , 401 ) ; }
Login user and return a token
Login user and return a token