1. Go to this page and download the library: Download flyo/nitro-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/** @var \Flyo\Model\ConfigResponse $config */
<div>
foreach($config->getContainers()['mainnav']->getItems() as $nav):
use App\Http\Controllers\TierController;
use Illuminate\Support\Facades\Route;
Route::get('/tier/{slug}', [TierController::class, 'show']);
namespace App\Http\Controllers;
use Flyo\Api\EntitiesApi;
use Flyo\Configuration;
use Illuminate\Contracts\View\Factory;
class TierController extends Controller
{
public function __construct(public Factory $viewFactory, public Configuration $config) {}
public function show(string $slug)
{
$api = new EntitiesApi(null, $this->config);
$entity = $api->entityBySlug($slug);
return $this->viewFactory->make('tier', [
'entity' => $entity,
]);
}
}
// use DI to resolve the Configuration object
public function __construct(public Flyo\Model\ConfigResponse $config)
{
}
// or facade
/** @var Flyo\Model\ConfigResponse $cfg */
$configResponse = app(Flyo\Model\ConfigResponse::class);
// use DI to resolve the Configuration object
public function __construct(public Flyo\Model\Page $page)
{
}
// or facade
/** @var Flyo\Model\Page $cfg */
$page = app(Flyo\Model\Page::class);