adrema/modules/Dashboard/Components/DashboardComponent.php

33 lines
910 B
PHP
Raw Permalink Normal View History

2024-09-24 01:26:08 +02:00
<?php
namespace Modules\Dashboard\Components;
use Livewire\Component;
use Modules\Dashboard\DashboardFactory;
class DashboardComponent extends Component
{
private array $blocks = [];
public function mount(DashboardFactory $factory): void
{
$this->blocks = $factory->load();
}
public function render(): string
{
return <<<'HTML'
2024-12-06 16:54:32 +01:00
<x-page::layout title="Dashboard" menu="dashboard">
2024-09-24 01:26:08 +02:00
<div class="gap-6 md:grid-cols-2 xl:grid-cols-4 grid p-6">
@foreach($this->blocks as $block)
<x-ui::box title="{{$block->title()}}" :second="true">
<livewire:dynamic-component is="{{ get_class($block) }}" lazy></livewire:dynamic-component>
</x-ui::box>
@endforeach
</div>
</x-page::layout>
HTML;
}
}