| 1234567891011121314151617181920212223242526272829 |
- @extends('layouts.app')
- @section('content')
- <div class="bg-white p-8 rounded shadow">
- <h1 class="text-4xl font-bold mb-4">{{ $post->title }}</h1>
- <p class="text-gray-700 leading-relaxed mb-8">{{ $post->content }}</p>
- <hr class="mb-8">
- <h3 class="text-2xl font-bold mb-4">Комментарии</h3>
- <div class="space-y-4 mb-8">
- {{-- Показываем только одобренные --}}
- @foreach($post->comments->where('is_approved', true) as $comment)
- <div class="bg-gray-50 p-4 rounded border">
- <strong>{{ $comment->author_name }}</strong>
- <p class="text-gray-600">{{ $comment->content }}</p>
- </div>
- @endforeach
- </div>
- <h3 class="text-xl font-bold mb-4">Оставить комментарий</h3>
- <form action="{{ route('comments.store', $post) }}" method="POST" class="space-y-4">
- @csrf
- <input type="text" name="author_name" placeholder="Ваше имя" class="w-full border p-2 rounded" required>
- <textarea name="content" placeholder="Ваш текст" class="w-full border p-2 rounded" required></textarea>
- <button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded">Отправить на модерацию</button>
- </form>
- </div>
- @endsection
|