My beer compendium
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

  1. @extends('beers')
  2. @section('main')
  3. <div class="container">
  4. <div class="row justify-content-center">
  5. <div class="col-md-8">
  6. <div class="card">
  7. @include('inc.navbar')
  8. <div class="card-header"><a href="/home">Home</a> -> {{ __('Beer List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
  9. <div class="card-body">
  10. @if (Auth::user()->isAdmin())
  11. <a href="{{ route('beers.create') }}" class="btn btn-primary">Add Beer</a>
  12. <hr />
  13. @endif
  14. <table class="table table-striped table-dark" id="table-programs">
  15. <!-- This piece of code is for error messages display purposes -->
  16. @include('inc.messages')
  17. <thead>
  18. <tr>
  19. <th scope="col">Name</th>
  20. <th scope="col">Brewery</th>
  21. <th scope="col">Style</th>
  22. @if (Auth::user()->isAdmin())<th colspan="2" scope="col">Admin</th>@endif
  23. </tr>
  24. </thead>
  25. <tbody>
  26. @foreach ($beers as $beer)
  27. <tr>
  28. <td><a href="/beer/{{$beer->beer_id}}">{{$beer->name}}</a> </td>
  29. <td><a href="/brewery/{{$beer->brewery_id}}">{{$beer->brewery}}</a> </td>
  30. <td>{{$beer->type}} </td>
  31. @if (Auth::user()->isAdmin())
  32. <td><a href="{{ route('beers.edit',$beer->beer_id)}}" class="btn btn-primary">Edit</a></td>
  33. <td><form action="{{ route('beers.destroy', $beer->beer_id)}}" method="post">
  34. @csrf
  35. @method('DELETE')
  36. <button class="btn btn-danger" type="submit">Delete</button>
  37. </form></td>
  38. @endif
  39. </tr>
  40. @endforeach
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. @endsection