Configuration
The package works without a published config. The full config/requests.php:
// config/requests.php
return [
'model' => RoundlyConsulting\Requests\Models\Request::class,
// bigint, uuid or ulid — the key type of the polymorphic author column
'key_type' => env('REQUESTS_KEY_TYPE', 'bigint'),
'enforce_transitions' => false,
'default_ttl' => null,
'register_facade_alias' => true,
];Every key
| Key | Default | Purpose |
|---|---|---|
model | Request::class | The request model used to create and query requests. Point it at a subclass to extend behaviour; a class that does not extend the packaged Request throws InvalidConfigurationException. |
key_type | bigint | Key type of the polymorphic author column — bigint, uuid or ulid (env REQUESTS_KEY_TYPE). Read when the migration runs; any other value throws InvalidConfigurationException. |
enforce_transitions | false | Enforce the lifecycle graph: illegal moves throw InvalidStatusTransition. Also gates the engine-to-status sync listener. Env strings true/1/on/yes and false/0/off/no work, a blank value is not set (so false); anything else throws InvalidConfigurationException. |
default_ttl | null | Minutes. Requests created without an explicit expiry get expires_at = now() + ttl. Not set (null or blank) = never expire automatically; anything but a positive whole number (at most 52560000, a hundred years) throws InvalidConfigurationException. |
register_facade_alias | true | Register the short Requests class alias. Skipped automatically if the host already aliased the name; the fully-qualified facade always works. A blank value is not set (so true); a value that isn’t a boolean spelling throws InvalidConfigurationException. |
Environment
Only the author key type is env-backed — set it before the migration runs, since it shapes the author_id column:
REQUESTS_KEY_TYPE=uuidValues from env() arrive as strings and are read accordingly: '60' is a 60-minute TTL, and 'true'/'1'/'on'/'yes' (or 'false'/'0'/'off'/'no') switch the two flags. A blank value ('' or whitespace, a bare KEY= line) is not set and takes the default. Any other flag value throws InvalidConfigurationException instead of quietly reading as the default.
Custom request model
Extend the packaged model to add relations, accessors or behaviour, then point requests.model at it. The builder, the author relations and the requests:expire command all resolve the configured class:
namespace App\Models;
use RoundlyConsulting\Requests\Models\Request;
class ExpenseClaim extends Request
{
// Keep the package table — a subclass would otherwise look for "expense_claims".
protected $table = 'requests';
}
// config/requests.php
'model' => App\Models\ExpenseClaim::class,The configured class must be RoundlyConsulting\Requests\Models\Request or a subclass of it, since anything else could not answer the scopes, the status lifecycle or the approval flow. A foreign model — or a class that doesn’t exist — throws InvalidConfigurationException naming requests.model instead of being silently replaced by the packaged model.
Approval engine settings
The approval mechanics — rules, staged pipelines, delegation, expiry and named workflow presets — are configured in config/approvals.php, owned by approvals-for-laravel. Publish it with the approvals-config tag when you want to define workflow presets.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.