43 lines
1 KiB
PHP
43 lines
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 = trans('b2in.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()
|
|
{
|
|
$this->content = cms_theme_section('magazin_list');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.web.components.sections.magazin-list');
|
|
}
|
|
}
|