show.blade.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @extends('layouts.master')
  2. @section('content')
  3. <div class="col-sm-8 blog-main">
  4. <h1>{{ $post->title }}</h1>
  5. <p class="blog-post-meta">
  6. {{ $post->created_at->toFormattedDateString() }}
  7. by <a href="#">Mark</a>
  8. </p>
  9. {{ $post->body }}
  10. @if (count($post->comments))
  11. <hr />
  12. <div class="comments">
  13. <ul class="list-group">
  14. @foreach($post->comments as $comment)
  15. <li class="list-group-item">
  16. <strong>{{ $comment->created_at->diffForHumans() }}</strong>
  17. :&nbsp;
  18. {{ $comment->body }}
  19. </li>
  20. @endforeach
  21. </ul>
  22. </div>
  23. @endif
  24. {{-- Add a comment --}}
  25. <div class="card">
  26. <div class="card-block">
  27. <form method="post" action="/posts/{{ $post->id }}/comments">
  28. {{-- Only needed for methods other than GET/POST, since most
  29. browsers only support those two --}}
  30. {{ method_field('POST') }}
  31. {{ csrf_field() }}
  32. @include('layouts.errors')
  33. <div class="form-group">
  34. <textarea required class="form-control" name="body" placeholder="Your comment here">
  35. </textarea>
  36. </div>
  37. <div class="form-group">
  38. <button type="submit" class="btn btn-primary">Add comment</button>
  39. </div>
  40. </form>
  41. </div>
  42. </div>
  43. </div>
  44. @endsection