1: <?php
2:
3: namespace LaravelUi5\Core\Attributes;
4:
5: use Attribute;
6: use LaravelUi5\Core\Enums\ParameterType;
7:
8: /**
9: * Declarative runtime parameter definition for UI5 actions and providers.
10: *
11: * Parameters defined via this attribute are always resolved from
12: * the action's route path segments and define the addressed
13: * domain context (e.g. resource identifiers).
14: *
15: * Non-identifying input (payload, options, flags) MUST be provided
16: * via the request body and validated using Laravel FormRequests.
17: *
18: * The order of Parameter attributes defines the positional order
19: * of path segments.
20: */
21: #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
22: class Parameter
23: {
24: /**
25: * @param string $name Logical parameter name (used as array key in the resolved args)
26: * @param string $uriKey External transport key (path segment name, as seen by the client)
27: * @param ParameterType $type Declared runtime type (drives casting/model binding)
28: * @param class-string|null $model Eloquent model FQCN; required when $type = ValueType::Model
29: */
30: public function __construct(
31: public string $name,
32: public string $uriKey,
33: public ParameterType $type,
34: public ?string $model = null,
35: )
36: {
37: }
38: }
39: