40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Enums\PostStatus;
|
|
use App\Models\Post;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Volt\Component;
|
|
|
|
new #[Layout('components.layouts.public')] class extends Component
|
|
{
|
|
public Post $post;
|
|
|
|
public function mount(Post $post): void
|
|
{
|
|
// Only show published posts
|
|
abort_unless($post->status === PostStatus::Published, 404);
|
|
|
|
$this->post = $post;
|
|
}
|
|
}; ?>
|
|
|
|
<article class="max-w-3xl mx-auto">
|
|
<header class="mb-8">
|
|
<flux:heading size="xl" class="text-text">{{ $post->getTitle() }}</flux:heading>
|
|
|
|
<time class="text-text/70 mt-2 block">
|
|
{{ $post->published_at?->translatedFormat('l, d F Y') ?? $post->created_at->translatedFormat('l, d F Y') }}
|
|
</time>
|
|
</header>
|
|
|
|
<div class="prose prose-lg prose-brand max-w-none">
|
|
{!! $post->getBody() !!}
|
|
</div>
|
|
|
|
<footer class="mt-12 pt-6 border-t border-accent/20">
|
|
<a href="{{ route('posts.index') }}" class="text-primary hover:underline" wire:navigate>
|
|
← {{ __('posts.back_to_posts') }}
|
|
</a>
|
|
</footer>
|
|
</article>
|