class AuthManager implements Factory (View source)

Traits

Properties

protected array $customProviderCreators

The registered custom provider creators.

from  CreatesUserProviders
protected Application $app

The application instance.

protected array $customCreators

The registered custom driver creators.

protected array $guards

The array of created "drivers".

protected Closure $userResolver

The user resolver shared by various services.

Methods

createUserProvider(string|null $provider = null)

Create the user provider implementation for the driver.

array|null
getProviderConfiguration(string|null $provider)

Get the user provider configuration.

createDatabaseProvider(array $config)

Create an instance of the database user provider.

createEloquentProvider(array $config)

Create an instance of the Eloquent user provider.

string
getDefaultUserProvider()

Get the default user provider name.

void
__construct(Application $app)

Create a new Auth manager instance.

guard(string|null $name = null)

Attempt to get the guard from the local cache.

resolve(string $name)

Resolve the given guard.

mixed
callCustomCreator(string $name, array $config)

Call a custom driver creator.

createSessionDriver(string $name, array $config)

Create a session based authentication guard.

createTokenDriver(string $name, array $config)

Create a token based authentication guard.

array
getConfig(string $name)

Get the guard configuration.

string
getDefaultDriver()

Get the default authentication driver name.

void
shouldUse(string $name)

Set the default guard driver the factory should serve.

void
setDefaultDriver(string $name)

Set the default authentication driver name.

$this
viaRequest(string $driver, callable $callback)

Register a new callback based request guard.

userResolver()

Get the user resolver callback.

$this
resolveUsersUsing(Closure $userResolver)

Set the callback to be used to resolve users.

$this
extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

$this
provider(string $name, Closure $callback)

Register a custom provider creator Closure.

bool
hasResolvedGuards()

Determines if any guards have already been resolved.

$this
forgetGuards()

Forget all of the resolved guard instances.

$this
setApplication(Application $app)

Set the application instance used by the manager.

mixed
__call(string $method, array $parameters)

Dynamically call the default driver instance.

Details

UserProvider|null createUserProvider(string|null $provider = null)

Create the user provider implementation for the driver.

Parameters

string|null $provider

Return Value

UserProvider|null

Exceptions

InvalidArgumentException

protected array|null getProviderConfiguration(string|null $provider)

Get the user provider configuration.

Parameters

string|null $provider

Return Value

array|null

protected DatabaseUserProvider createDatabaseProvider(array $config)

Create an instance of the database user provider.

Parameters

array $config

Return Value

DatabaseUserProvider

protected EloquentUserProvider createEloquentProvider(array $config)

Create an instance of the Eloquent user provider.

Parameters

array $config

Return Value

EloquentUserProvider

string getDefaultUserProvider()

Get the default user provider name.

Return Value

string

void __construct(Application $app)

Create a new Auth manager instance.

Parameters

Application $app

Return Value

void

Guard|StatefulGuard guard(string|null $name = null)

Attempt to get the guard from the local cache.

Parameters

string|null $name

Return Value

Guard|StatefulGuard

protected Guard|StatefulGuard resolve(string $name)

Resolve the given guard.

Parameters

string $name

Return Value

Guard|StatefulGuard

Exceptions

InvalidArgumentException

protected mixed callCustomCreator(string $name, array $config)

Call a custom driver creator.

Parameters

string $name
array $config

Return Value

mixed

SessionGuard createSessionDriver(string $name, array $config)

Create a session based authentication guard.

Parameters

string $name
array $config

Return Value

SessionGuard

TokenGuard createTokenDriver(string $name, array $config)

Create a token based authentication guard.

Parameters

string $name
array $config

Return Value

TokenGuard

protected array getConfig(string $name)

Get the guard configuration.

Parameters

string $name

Return Value

array

string getDefaultDriver()

Get the default authentication driver name.

Return Value

string

void shouldUse(string $name)

Set the default guard driver the factory should serve.

Parameters

string $name

Return Value

void

void setDefaultDriver(string $name)

Set the default authentication driver name.

Parameters

string $name

Return Value

void

$this viaRequest(string $driver, callable $callback)

Register a new callback based request guard.

Parameters

string $driver
callable $callback

Return Value

$this

Closure userResolver()

Get the user resolver callback.

Return Value

Closure

$this resolveUsersUsing(Closure $userResolver)

Set the callback to be used to resolve users.

Parameters

Closure $userResolver

Return Value

$this

$this extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Parameters

string $driver
Closure $callback

Return Value

$this

$this provider(string $name, Closure $callback)

Register a custom provider creator Closure.

Parameters

string $name
Closure $callback

Return Value

$this

bool hasResolvedGuards()

Determines if any guards have already been resolved.

Return Value

bool

$this forgetGuards()

Forget all of the resolved guard instances.

Return Value

$this

$this setApplication(Application $app)

Set the application instance used by the manager.

Parameters

Application $app

Return Value

$this

mixed __call(string $method, array $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array $parameters

Return Value

mixed

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.