| 12345678910111213141516171819202122232425262728293031323334353637 |
- @extends('layouts.app')
- @section('content')
- <h1 class="text-3xl font-bold mb-6">Все публикации</h1>
- <div class="grid gap-6">
- @foreach($posts as $post)
- <div class="bg-white p-6 rounded shadow flex justify-between items-center">
- <div>
- <a href="{{ route('posts.show', $post) }}" class="text-xl font-semibold hover:underline">
- {{ $post->title }}
- </a>
- <div class="text-sm text-gray-500">
- Статус:
- <span class="{{ $post->is_published ? 'text-green-600' : 'text-orange-600' }}">
- {{ $post->is_published ? 'Опубликован' : 'Черновик' }}
- </span>
- @if($post->published_at) | План: {{ $post->published_at }} @endif
- </div>
- </div>
- <div class="flex space-x-2">
- <form action="{{ route('posts.publish', $post) }}" method="POST">
- @csrf
- <button class="bg-gray-200 px-3 py-1 rounded text-sm">
- {{ $post->is_published ? 'Снять' : 'Опубликовать' }}
- </button>
- </form>
- <a href="{{ route('posts.edit', $post) }}" class="bg-blue-500 text-white px-3 py-1 rounded text-sm">Ред.</a>
- <form action="{{ route('posts.destroy', $post) }}" method="POST">
- @csrf @method('DELETE')
- <button class="bg-red-500 text-white px-3 py-1 rounded text-sm">Удалить</button>
- </form>
- </div>
- </div>
- @endforeach
- </div>
- @endsection
|