Created
February 22, 2020 08:18
-
-
Save rizkhal/10504b3863321bd826bd38d32e7b13a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.master') | |
@push('heading') | |
@component('components.heading') | |
All Posts | |
@endcomponent | |
@endpush | |
@push('button') | |
@component('components.button') | |
@slot('url') | |
{{ route('posts.create') }} | |
@endslot | |
@slot('text') | |
New Post | |
@endslot | |
@endcomponent | |
@endpush | |
@section('body') | |
<table class="table table-hover"> | |
<thead> | |
<tr> | |
<th scope="col">#</th> | |
<th scope="col">Title</th> | |
<th scope="col">Body</th> | |
<th scope="col">Action</th> | |
</tr> | |
</thead> | |
<tbody> | |
@if (count($posts) > 0) | |
@foreach ($posts as $key => $post) | |
<tr> | |
<th scope="row">{{$posts->firstItem() + $key}}</th> | |
<td>{{Str::limit($post->title, 20)}}</td> | |
<td>{{Str::limit($post->body, 20)}}</td> | |
<td> | |
<a href="{{ route('posts.edit', $post->slug) }}" class="btn btn-sm btn-warning"> | |
<i class="fas fa-edit"></i> | |
</a> | |
<a href="{{ route('posts.destroy', $post->slug) }}" class="btn btn-sm btn-danger"> | |
<i class="fas fa-trash"></i> | |
</a> | |
</td> | |
</tr> | |
@endforeach | |
@else | |
<tr> | |
<th colspan="4" class="text-center">Not Found</th> | |
</tr> | |
@endif | |
</tbody> | |
</table> | |
{{$posts->links()}} | |
@endsection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment