b2in/app/Livewire/Web/Components/Sections/MagazinList.php
2025-10-20 17:50:35 +02:00

43 lines
1.1 KiB
PHP

<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class MagazinList extends Component
{
public $posts = [];
public $content = [];
public function mount()
{
$this->loadPosts();
$this->loadThemeContent();
}
private function loadPosts()
{
$articles = config('content.articles', []);
$this->posts = collect($articles)->map(function ($article) {
return [
'id' => $article['id'],
'title' => $article['title'],
'excerpt' => $article['content']['intro'], // Using intro as excerpt
'image' => $article['image'],
'date' => $article['date'],
'readTime' => $article['readTime'],
];
})->all();
}
private function loadThemeContent()
{
$theme = config('app.theme', 'b2in');
$this->content = config("content.themes.{$theme}.magazin_list", []);
}
public function render()
{
return view('livewire.web.components.sections.magazin-list');
}
}