/**
  * Retrieve a user by the given credentials.
  *
  * @param  array  $credentials
  * @return \Auth\UserInterface|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     // First we will add each credential element to the query as a where clause.
     // Then we can execute the query and, if we found a user, return it in a
     // generic "user" object that will be utilized by the Guard instances.
     $query = $this->conn->table($this->table);
     foreach ($credentials as $key => $value) {
         if (!str_contains($key, 'password')) {
             $query->where($key, $value);
         }
     }
     // Now we are ready to execute the query to see if we have an user matching
     // the given credentials. If not, we will just return nulls and indicate
     // that there are no matching users for these given credential arrays.
     $user = $query->first();
     if (!is_null($user)) {
         return new GenericUser((array) $user);
     }
 }
 /**
  * Get a QueryBuilder instance for the given database Table.
  *
  * @param  string  $table
  * @return \Database\Query
  */
 protected function table($table)
 {
     return $this->db->table($table);
 }
 /**
  * Get a fresh query builder instance for the table.
  *
  * @return \Database\Query\Builder
  */
 protected function getQuery()
 {
     return $this->connection->table($this->table);
 }
 /**
  * Create a new database query
  *
  * @return \Database\Query
  */
 public function newQuery()
 {
     return $this->connection->table($this->table);
 }
 /**
  * Get a query builder for the cache table.
  *
  * @return \Database\Query\Builder
  */
 protected function table()
 {
     return $this->connection->table($this->table);
 }