<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
  <th>Category</th>
  <th>SubCategory</th>
  <th>Title</th>
  <th>Status</th>
  <th>Thumbnail</th>
  <th>Date</th>
  <th>Views</th>
  <th>Preview</th>
  <th>Action</th>
</tr>
</thead>

<tbody>

@foreach($posts as $row)

<tr>
  <td>{{ $row->category_bn }}</td>
  <td>{{ $row->subcategory_bn }}</td>
  <td>{{ $row->title_bn }}</td>
<td>
  @if($row->status == 'active')
      <span class="badge badge-success">Active</span>
  @else
      <span class="badge badge-danger">Inactive</span>
  @endif
</td>
  <td>
    <img src="{{ URL::to($row->image) }}" style="height:60px;width:60px;">
  </td>

  <td>{{ $row->post_date }}</td>
  <td>{{ $row->views }}</td>

  @php
    $slug = preg_replace('/\s+/u','-',trim($row->title_bn ?? ''));
  @endphp

  <td>
    <a href="{{ URL::to('view-post/'.$row->id.'/'.$slug) }}" class="btn btn-info">
      <i class="fa fa-eye"></i>
    </a>
  </td>

  <td>
    <a href="{{ route('edit.post',$row->id) }}" class="btn btn-info">
      <i class="fa fa-edit"></i>
    </a>

    <a href="{{ route('delete.post',$row->id) }}" class="btn btn-danger" id="delete">
      <i class="fa fa-trash"></i>
    </a>
  </td>

</tr>

@endforeach

</tbody>
</table>