| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- @extends('layouts.app')
- @section('title', 'Все посты')
- @section('content')
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
- <div class="mb-8">
- <h1 class="text-4xl font-bold text-gray-900">Все публикации</h1>
- <p class="mt-2 text-gray-600">Читайте наши последние статьи и новости</p>
- </div>
- @if($posts->isEmpty())
- <div class="bg-white rounded-lg shadow-md p-12 text-center">
- <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
- </svg>
- <h3 class="mt-2 text-sm font-medium text-gray-900">Постов пока нет</h3>
- <p class="mt-1 text-sm text-gray-500">Начните с создания нового поста</p>
- <div class="mt-6">
- <a href="{{ route('posts.create') }}" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700">
- <svg class="-ml-1 mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
- </svg>
- Создать пост
- </a>
- </div>
- </div>
- @else
- <div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
- @foreach($posts as $post)
- <article class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-xl transition-shadow duration-300">
- <div class="p-6">
- <div class="flex items-center text-sm text-gray-500 mb-3">
- <svg class="h-4 w-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
- </svg>
- <time datetime="{{ $post->published_at }}">
- {{ $post->published_at->format('d.m.Y') }}
- </time>
- </div>
- <h2 class="text-xl font-bold text-gray-900 mb-3 line-clamp-2">
- <a href="{{ route('posts.show', $post) }}" class="hover:text-indigo-600 transition-colors">
- {{ $post->title }}
- </a>
- </h2>
- <p class="text-gray-600 mb-4 line-clamp-3">
- {{ Str::limit(strip_tags($post->content), 150) }}
- </p>
- <div class="flex items-center justify-between">
- <a href="{{ route('posts.show', $post) }}" class="text-indigo-600 hover:text-indigo-800 font-medium text-sm flex items-center">
- Читать далее
- <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
- </svg>
- </a>
-
- <div class="flex items-center text-gray-500 text-sm">
- <svg class="h-4 w-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"/>
- </svg>
- {{ $post->comments()->approved()->count() }}
- </div>
- </div>
- </div>
- </article>
- @endforeach
- </div>
- {{-- Пагинация --}}
- <div class="mt-8">
- {{ $posts->links() }}
- </div>
- @endif
- </div>
- @endsection
|