/** * Retrieve a user by the given credentials. * * @param array $credentials * @return \Nova\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 query builder for the cache table. * * @return \Nova\Database\Query\Builder */ protected function table() { 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 fresh query builder instance for the table. * * @return \Nova\Database\Query\Builder */ protected function getQuery() { return $this->connection->table($this->table); }