Files
einundzwanzig-portal/app/Http/Livewire/News/InternArticleView.php
Benjamin Takats dadf334fcf 5932490
2023-01-25 16:01:31 +01:00

34 lines
1.2 KiB
PHP

<?php
namespace App\Http\Livewire\News;
use App\Models\LibraryItem;
use Carbon\Carbon;
use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData;
class InternArticleView extends Component
{
public LibraryItem $libraryItem;
public function render()
{
if ($this->libraryItem->type === 'markdown_article') {
$description = $this->libraryItem->excerpt ?? __('An entry in the library of Einundzwanzig.');
} else {
$description = $this->libraryItem->excerpt ?? __('Here we post important news that is relevant for everyone.');
}
return view('livewire.news.intern-article-view')->layout('layouts.app', [
'SEOData' => new SEOData(
title: $this->libraryItem->name,
description: strip_tags($this->libraryItem->excerpt) ?? __('Here we post important news that is relevant for everyone.'),
author: $this->libraryItem->lecturer->name,
image: $this->libraryItem->getFirstMedia('main') ? $this->libraryItem->getFirstMediaUrl('main') : asset('img/einundzwanzig-wallpaper-benrath.png'),
published_time: Carbon::parse($this->libraryItem->created_at),
type: 'article',
)
]);
}
}