Skip to content

Parameters ​

Introduction ​

LaravelUi5 has three distinct ways to feed runtime values into your backend logic. They are not alternatives that compete — they are complementary, each with its own job, and all three are here to stay:

  • #[Parameter] binds a value from the route — a path segment in the URL, typically a resource identifier (…/{invoice}). This page.
  • #[Setting] declares a configuration value — a named, typed, JSON-safe value with a default, attached to the class that consumes it. See Settings.
  • #[Slot] resolves a value through a pipeline — a contextual value that can arrive from several places, with a guaranteed fallback (query string → Composition → Setting → Default). See Slots.

If you remember one thing: a Parameter answers which record, a Setting answers how is this configured, and a Slot answers in what context.

The three at a glance ​

#[Parameter]#[Setting]#[Slot]
Comes fromthe route (a URL path segment)the declaration's own defaulta resolution pipeline, starting at the query string
Resolution orderpositional, single sourcedefault (Core) — storage-backed in the SDKQuery → Composition → Setting → Default; the SDK inserts Actor after the query
Declared onthe action or the resourcethe handler / provider or the artifactthe module class
Typical use"which Invoice?" — resource identity"how many rows? which endpoint?" — configuration"which date range / time zone / locale?" — context
Always present?only if the route segment is suppliedyes — a default is mandatoryyes — a Slot always resolves (it has a declared default)
Reaches you asa method argumenta virtual read-only property ($this->key)a name → value map for the requested slots
Type vocabularyParameterTypeValueTypeParameterType (never Model)

They never substitute for one another — which is exactly why all three remain a permanent part of the platform.

The URL splits cleanly between them. In /calendar/2026-11/users/1?timezone=Europe%2FVienna the path segments are identity — the month and the user, #[Parameter]s, the user resolved to a model — and the query string is context — the time zone, a #[Slot]. Neither mechanism reads the other's half: a slot is never taken from the path, and a parameter never from the query.

changed in 3.0Slots no longer read route parameters or the request body.

#[Parameter] — route-bound values ​

A Parameter pins a value taken straight from the request URL. It is the way an Action or Resource says "I operate on this specific record." Identifiers go in the path; everything else (payloads, options, flags) belongs in the request body and is validated with a Laravel FormRequest.

Declare it on the action — or the resource — and receive it in the handler or provider as a method argument of the same name:

php
use LaravelUi5\Core\Ui5\AbstractUi5Action;
use LaravelUi5\Core\Ui5\Attributes\Parameter;
use LaravelUi5\Core\Parameters\Enums\ParameterType;

#[Parameter(
    name:   'invoice',
    uriKey: 'invoice',
    type:   ParameterType::Model,
    model:  Invoice::class,
)]
class ApproveInvoiceAction extends AbstractUi5Action
{
    // NAMESPACE, METHOD …
    public const string HANDLER = ApproveInvoiceHandler::class;
}
php
use LaravelUi5\Core\Ui5\AbstractConfigurable;
use LaravelUi5\Core\Ui5\Capabilities\ActionHandlerInterface;

class ApproveInvoiceHandler extends AbstractConfigurable implements ActionHandlerInterface
{
    public function handle(Invoice $invoice, InvoiceApprover $approver): array // InvoiceApprover bound in a service provider
    {
        $approver->approve($invoice);

        return ['status' => 'success', 'message' => "Invoice {$invoice->number} approved."];
    }
}
changed in 6.0`#[Parameter]` sits on the action or the resource. Until 6.0 it sat on the handler or the provider; the registry now refuses it there at boot, naming the class and its declaration.
  • name is the logical name; the resolved value is injected into the method argument that matches it (Invoice $invoice above).
  • uriKey is the path-segment name as the client sees it. The action's URL becomes …/[email protected]/{invoice}.
  • type: ParameterType::Model with a model: class resolves the segment to an Eloquent instance (model binding); scalar types cast the raw segment.
  • The attribute is repeatable — stack several to declare multiple path segments; their order defines the positional order in the URL.

Route Parameters are identifying input only. Keep payloads and options in the request body (a FormRequest), per Laravel convention.

The type vocabulary ​

ParameterType is the scalar vocabulary shared with #[Slot]:

CaseResolves to
Stringthe raw segment, as string
Integeran int
Floata float
Decimala numeric string, e.g. '19.99' — fixed precision, never a binary float
Booleana bool (true/false, 1/0, yes/no, on/off)
Datea Carbon
DateTimea Carbon
Modelan Eloquent instance — requires model: — Parameters only

A segment that does not cast — abc for an Integer, 1e3 for a Decimal — is a 400 naming the parameter.

changed in 3.0Scalar types reach the handler; until 3.0 only `Model` and `Date` got past the type guard, and `Decimal` and `DateTime` did not cast.

ParameterType::Model is the one case Slots may not use: a slot is a wire-shaped value, not a record reference. That is precisely the line between the two mechanisms.

Where it happens in the request ​

ExecutableInvoker — the path an Action, Resource, or Card takes — resolves Parameters first, injects Settings second, then builds the argument list from the method signature. Each argument is filled in this order:

  1. a FormRequest subclass → instantiated by the container, with authorize() and validation triggered;
  2. a name matching a declared Parameter → the resolved value, type-guarded against the method signature: a class type with instanceof, a scalar type as itself, and an int widens to a float argument — nothing else converts. A mismatch ('42' for an int $count) throws InvalidParameterTypeException;
  3. a class the container has a binding for ($container->has()) → resolved as a service. An unbound class is not autowired here, even if the container could build it.

An argument that fits none of the three is a LogicException naming the class and method — the failure is loud and immediate, never a silent null.

Choosing between them ​

Ask one question about the value: is it an identifier in the URL, a knob somebody configures, or a context with a fallback?

  • "Approve invoice 42" → the 42 identifies a record → #[Parameter].
  • "Show at most 20 rows" → a configured knob with a sensible default → #[Setting].
  • "Show the report for this quarter, in Vienna time" → contextual values resolved from several possible sources → #[Slot].

They frequently appear together: an Action takes a route #[Parameter] for the record it acts on, a #[Setting] for its threshold, and a Report uses #[Slot]s for its date range and time zone. Reach for the one that matches the kind of value — never force one to do another's job.