flyo / nitro-laravel
Flyo Nitro Laravel Framework Module
dev-main
2023-06-14 07:58 UTC
Requires
- flyo/nitro-php: dev-main
- illuminate/support: ^10.9
- illuminate/view: ^10.9
- laravel/helpers: ^1.6
This package is auto-updated.
Last update: 2024-04-14 09:44:39 UTC
README
composer require flyo/nitro-laravel
publish the config
artisan vendor:publish
Adjust the token in config/flyo.php
Views
Add/Adjust the cms.blade.php
view file in resources/views
, this is where the cms page loader starts:
<?php /** @var \Flyo\Model\Page */ ?> <x-flyo::page :page=$page />
Now all component block views are looked up in ressources/views/flyo
, for example if you have a Flyo Nitro component block with name Text the view file would be ressources/views/flyo/Text.blade.php
utilizing the following variables:
<?php /** @var \Flyo\Model\Block $block */ print_r($block->getContent()); print_r($block->getConfig()); print_r($block->getItems()); print_r($block->getSlots()); ?>
Layout Variable
In order to build menus, the $config
response from the api is a global available variable, for example this could be used in layout-components:
/** @var \Flyo\Model\ConfigResponse $config */ <div> <?php foreach($config->getNav()->getItems() as $nav): ?> <a href="<?= $nav->getHref(); ?>"><?= $nav->getLabel(); ?></a> <?php endforeach; ?> </div>