show.blade.php 1.3 KB

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