-
Notifications
You must be signed in to change notification settings - Fork 1
index.blade.php(default)
Tady edited this page Sep 6, 2023
·
2 revisions
<table cellspacing="1" style="background-color:black;width:90%;">
<caption style="padding:10px 0;">
<h1>Posts</h1>
<a href="{{ url()->previous() }}"
style="text-decoration:none;background-color:#5bc0de;color:white;padding:5px 5px;text-align:center;display:inline-block;border-radius:5px;">
Go Back
</a>
<a href="{{route('posts.create')}}"
style="text-decoration:none;background-color:#0275d8;color:white;padding:5px 5px;text-align:center;display:inline-block;border-radius:5px;">
Create post
</a>
</caption>
<thead>
<tr style="background-color:white;">
<th>Id</th>
<th>Title</th>
<th>Content</th>
<th>Created at</th>
<th>Updated at</th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($posts) > 0)
@foreach($posts as $post)
<tr style="background-color:white;">
<td>{{ $post->id}} </td>
<td>{{ $post->title}} </td>
<td>{{ $post->content}} </td>
<td>{{ $post->created_at}} </td>
<td>{{ $post->updated_at}} </td>
<td>
<a href="{{route('posts.show', $post->id)}}"
style="text-decoration:none;background-color:#5bc0de;color:white;padding:5px 5px;text-align:center;display:inline-block;border-radius:5px;">
Show
</a>
<a href="{{route('posts.edit', $post->id)}}"
style="text-decoration:none;background-color:#0275d8;color:white;padding:5px 5px;text-align:center;display:inline-block;border-radius:5px;">
Edit
</a>
<form method="POST" action="{{ route('posts.destroy', $post->id) }}" style="display: inline-block;">
@csrf
@method('DELETE')
<button type="submit"
style="background-color:#d9534f;color:white;padding:5px 5px;text-align:center;display:inline-block;border: none;border-radius:5px;"
onclick="return confirm('Are you sure you want to delete this post?')">
Delete
</button>
</form>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>