Interface LaravelUi5\Core\Ui5\Capabilities\DataProviderInterface

Marker for a UI5 data provider — the read-only behaviour behind a Resource, Card, or Report. It delivers structured, JSON-serializable data and must not mutate state.

Why a marker, not a typed method. The provide() method's parameters are resolved by the container at invoke time, which a PHP interface cannot express — the same reason Laravel's own ShouldQueue is a marker and never types handle(). So the contract is documented + runtime-enforced, not signature-enforced:

  • provide(): array — return JSON-serializable data; side-effect free; the array should be normalized (scalars / nested arrays), not raw models.
  • {@see \LaravelUi5\Core\Runtime\ExecutableInvoker} calls provide() and throws {@see \LaravelUi5\Core\Exceptions\MissingExecutableMethodException} if it is absent.

Injection recipe (good style — the same on every invoked-behaviour capability):

  • Services, repositories, gateways → the constructor. The artifact returns the provider via app(YourProvider::class) from getProvider(), so the container autowires them. This also sidesteps the invoker's has()-only method-parameter resolution (constructor DI uses full container autowiring).
  • Per-request inputs → provide()'s method parameters — route-resolved models, #[Parameter] / slot values (or a array $slots map, e.g. a Report provider), a FormRequest, the Ui5ContextInterface. They exist only at invocation, exactly like Laravel route-model binding lands on a controller method.
Methods