@extends('layouts.app') @section('content')
Posts @can('create-post') Create New Post @endcan
@if(session('success'))
{{ session('success') }}
@endif @if($posts->count() > 0)
@foreach($posts as $post)
{{ $post->title }} @if($post->user_id !== auth()->id()) автор: {{ $post->user->name }} @endif

{{ Str::limit($post->content, 100) }}

{{ $post->created_at->diffForHumans() }}
@can('update-post', $post) Edit @endcan @can('delete-post', $post)
@csrf @method('DELETE')
@endcan
@endforeach
{{ $posts->links() }}
@else

No posts found.

@endif
@endsection