| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Controllers; |
| 4: | |
| 5: | use Illuminate\Http\Response; |
| 6: | use Illuminate\Routing\Controller; |
| 7: | use Illuminate\Support\Facades\Blade; |
| 8: | use LaravelUi5\Core\Contracts\ExecutableInvokerInterface; |
| 9: | use LaravelUi5\Core\Contracts\Ui5ContextInterface; |
| 10: | use LaravelUi5\Core\Ui5\Capabilities\DataProviderInterface; |
| 11: | use LaravelUi5\Core\Ui5\Contracts\Ui5CardInterface; |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | class CardController extends Controller |
| 34: | { |
| 35: | public function __invoke(Ui5ContextInterface $context, ExecutableInvokerInterface $invoker): Response |
| 36: | { |
| 37: | |
| 38: | $card = $context->artifact(); |
| 39: | |
| 40: | $data = $invoker->invoke( |
| 41: | $card->getProvider(), |
| 42: | 'provide' |
| 43: | ); |
| 44: | |
| 45: | $compiled = Blade::render($card->getManifest(), [ |
| 46: | 'card' => $card, |
| 47: | 'data' => $data, |
| 48: | ]); |
| 49: | |
| 50: | return response($compiled, 200)->header('Content-Type', 'application/json'); |
| 51: | } |
| 52: | } |
| 53: | |