post.blade.php 844 Bytes
Newer Older
Littichai Buddaken's avatar
Littichai Buddaken committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
@extends('layouts.app')

@section('main')
<a class="btn btn-primary" href="blog/create" role="button">new post</a>
<table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">User</th>
      <th scope="col">Title</th>
      <th scope="col">-</th>
    </tr>
  </thead>
  <tbody>
  @foreach($the_posts as $post)
    <tr>
      <th scope="row">{{$post->id}}</th>
      <td>{{$post->user_id}}</td>
      <td><a href="blog/{{$post->id}}">{{$post->title}}</a></td>
      <td>
        <a class="btn btn-info" href="blog/{{$post->id}}/edit" role="button">edit</a>
        <form action="blog/{{$post->id}}" method="post">
          @csrf
          @method('DELETE')
          <button class="btn btn-danger" type="submit">delete</button>
        </form>
      </td>
    </tr>
  @endforeach
  </tbody>
</table>
@endsection