/**
  * Get the user for the given credentials.
  *
  * @param  array  $credentials
  * @return \Auth\Reminders\RemindableInterface
  *
  * @throws \UnexpectedValueException
  */
 public function getUser(array $credentials)
 {
     $credentials = array_except($credentials, array('token'));
     $user = $this->users->retrieveByCredentials($credentials);
     if ($user && !$user instanceof RemindableInterface) {
         throw new \UnexpectedValueException("User must implement Remindable interface.");
     }
     return $user;
 }
 /**
  * Attempt to authenticate a user using the given credentials.
  *
  * @param  array  $credentials
  * @param  bool   $remember
  * @param  bool   $login
  * @return bool
  */
 public function attempt(array $credentials = array(), $remember = false, $login = true)
 {
     $this->fireAttemptEvent($credentials, $remember, $login);
     $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials);
     // If an implementation of UserInterface was returned, we'll ask the provider
     // to validate the user against the given credentials, and if they are in
     // fact valid we'll log the users into the application and return true.
     if ($this->hasValidCredentials($user, $credentials)) {
         if ($login) {
             $this->login($user, $remember);
         }
         return true;
     }
     return false;
 }