1: <?php
2:
3: namespace LaravelUi5\Core\View\Components;
4:
5: use Illuminate\View\Component;
6: use LaravelUi5\Core\Ui5\Capabilities\ResolvableInterface;
7: use LaravelUi5\Core\Ui5\Contracts\Ui5RegistryInterface;
8: use Psr\Container\ContainerExceptionInterface;
9: use Psr\Container\NotFoundExceptionInterface;
10:
11: class Ui5Element extends Component
12: {
13:
14: public function __construct(public string $id)
15: {
16: }
17:
18: /**
19: * @throws ContainerExceptionInterface
20: * @throws NotFoundExceptionInterface
21: */
22: public function render(): string
23: {
24: $artifact = app(Ui5RegistryInterface::class)->get($this->id);
25:
26: if ($artifact instanceof ResolvableInterface) {
27: return $artifact->resolve();
28: }
29:
30: return '';
31: }
32: }
33: