adrema/app/View/Page/SettingLayout.php

38 lines
924 B
PHP
Raw Normal View History

2024-10-14 20:25:11 +02:00
<?php
namespace App\View\Page;
use App\Setting\SettingFactory;
use Illuminate\View\Component;
class SettingLayout extends Component
{
public array $entries;
public function __construct(public string $active)
{
$this->entries = app(SettingFactory::class)->all()
->map(fn ($setting) => [
'url' => $setting->url(),
'is_active' => get_class($setting) === $active,
'title' => $setting->title(),
])->toArray();
}
public function render()
{
return <<<'HTML'
<x-page::layout>
<x-slot:right>
{{ $right }}
</x-slot:right>
<div class="flex grow relative">
<x-ui::menulist :entries="$entries"></x-ui::menulist>
{{ $slot }}
</div>
</x-page::layout>
HTML;
}
}