complete story 5.4 with qa tests
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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-navy">{{ $post->getTitle() }}</flux:heading>
|
||||
|
||||
<time class="text-charcoal/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-navy max-w-none">
|
||||
{!! $post->getBody() !!}
|
||||
</div>
|
||||
|
||||
<footer class="mt-12 pt-6 border-t border-charcoal/20">
|
||||
<a href="{{ route('posts.index') }}" class="text-gold hover:underline" wire:navigate>
|
||||
← {{ __('posts.back_to_posts') }}
|
||||
</a>
|
||||
</footer>
|
||||
</article>
|
||||
Reference in New Issue
Block a user