ApiContext
in package
Global registry for authenticated API request context.
Stores the API key record and business ID for the current request, set by ApiAuthMiddleware and consumed by API controllers.
Tags
Table of Contents
Properties
- $apiKey : array<string|int, mixed>|null
Methods
- businessId() : int|null
- Get the business ID from the authenticated API key.
- clear() : void
- Clear the API context (for testing).
- get() : array<string|int, mixed>|null
- Get the authenticated API key record.
- keyId() : int|null
- Get the API key ID.
- set() : void
- Set the authenticated API key context.
Properties
$apiKey
private
static array<string|int, mixed>|null
$apiKey
= \null
The authenticated API key record
Methods
businessId()
Get the business ID from the authenticated API key.
public
static businessId() : int|null
Return values
int|nullclear()
Clear the API context (for testing).
public
static clear() : void
get()
Get the authenticated API key record.
public
static get() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullkeyId()
Get the API key ID.
public
static keyId() : int|null
Return values
int|nullset()
Set the authenticated API key context.
public
static set(array<string|int, mixed> $apiKey) : void
Parameters
- $apiKey : array<string|int, mixed>
-
API key record (from ApiKey::findByKey)