original_string: public function authenticate(Request $request)
      {
          $email    = $request->input(self::AUTH_PARAM_EMAIL, null);
          $password = $request->input(self::AUTH_PARAM_PASSWORD, null);
  
          if ($email !== null &&
              $password !== null &&
              ($user = User::query()->where(User::FIELD_EMAIL, '=', strtolower($email))->first()) !== null
          ) {
              /** @var HasherInterface $hasher */
              $hasher = app(HasherInterface::class);
              if ($hasher->check($password, $user->{User::FIELD_PASSWORD_HASH}) === true) {
                  /** @var TokenCodecInterface $codec */
                  $codec = app(TokenCodecInterface::class);
                  $token = $codec->encode($user);
  
                  $this->getLogger()->debug(
                      'Account login success.',
                      [User::FIELD_EMAIL => $email, User::FIELD_ID => $user->getKey()]
                  );
  
                  return response($token);
              }
          }
  
          $this->getLogger()->debug('Account login failed.', [User::FIELD_EMAIL => $email]);
  
          return response(null, Response::HTTP_UNAUTHORIZED);
      }
code: public function authenticate(Request $request)
      {
          $email    = $request->input(self::AUTH_PARAM_EMAIL, null);
          $password = $request->input(self::AUTH_PARAM_PASSWORD, null);
  
          if ($email !== null &&
              $password !== null &&
              ($user = User::query()->where(User::FIELD_EMAIL, '=', strtolower($email))->first()) !== null
          ) {
              /** @var HasherInterface $hasher */
              $hasher = app(HasherInterface::class);
              if ($hasher->check($password, $user->{User::FIELD_PASSWORD_HASH}) === true) {
                  /** @var TokenCodecInterface $codec */
                  $codec = app(TokenCodecInterface::class);
                  $token = $codec->encode($user);
  
                  $this->getLogger()->debug(
                      'Account login success.',
                      [User::FIELD_EMAIL => $email, User::FIELD_ID => $user->getKey()]
                  );
  
                  return response($token);
              }
          }
  
          $this->getLogger()->debug('Account login failed.', [User::FIELD_EMAIL => $email]);
  
          return response(null, Response::HTTP_UNAUTHORIZED);
      }
code_tokens: public function authenticate ( Request $ request ) { $ email = $ request -> input ( self :: AUTH_PARAM_EMAIL , null ) ; $ password = $ request -> input ( self :: AUTH_PARAM_PASSWORD , null ) ; if ( $ email !== null && $ password !== null && ( $ user = User :: query ( ) -> where ( User :: FIELD_EMAIL , '=' , strtolower ( $ email ) ) -> first ( ) ) !== null ) { /** @var HasherInterface $hasher */ $ hasher = app ( HasherInterface :: class ) ; if ( $ hasher -> check ( $ password , $ user -> { User :: FIELD_PASSWORD_HASH } ) === true ) { /** @var TokenCodecInterface $codec */ $ codec = app ( TokenCodecInterface :: class ) ; $ token = $ codec -> encode ( $ user ) ; $ this -> getLogger ( ) -> debug ( 'Account login success.' , [ User :: FIELD_EMAIL => $ email , User :: FIELD_ID => $ user -> getKey ( ) ] ) ; return response ( $ token ) ; } } $ this -> getLogger ( ) -> debug ( 'Account login failed.' , [ User :: FIELD_EMAIL => $ email ] ) ; return response ( null , Response :: HTTP_UNAUTHORIZED ) ; }
docstring: Issue auth token.
  
  @param Request $request
  
  @return Response
docstring_tokens: Issue auth token .