ModelUserProvider
final class ModelUserProvider implements UserProvider
Retrieves and validates Principals backed by the Users model. Isolates all knowledge of how users are stored and looked up, so the guard can authenticate against the Users model through the UserProvider contract without depending on it directly.
Properties
| private Hasher | $hasher | The hasher used to verify supplied passwords against stored hashes. |
|
| private User> | $model | The user model class used for lookups. |
Methods
Retrieves a principal by its unique identifier.
Retrieves a principal matching the given credentials, without verifying them. Looks the user up by username only; password verification is performed separately by validateCredentials().
Verifies that the supplied password matches the principal's stored hash.
Details
at line 36
__construct(Hasher $hasher, string $model)
No description
at line 47
Principal|null
retrieveById(mixed $id)
Retrieves a principal by its unique identifier.
at line 61
Principal|null
retrieveByCredentials(array $credentials)
Retrieves a principal matching the given credentials, without verifying them. Looks the user up by username only; password verification is performed separately by validateCredentials().
at line 76
bool
validateCredentials(Principal $user, array $credentials)
Verifies that the supplied password matches the principal's stored hash.