@extends('layouts.app') @section('content')

{{ $post->title }}

@if($post->user_id == Auth::user()->id || Auth::user()->hasRole('admin'))
{{ __('Edit') }}
@csrf @method('DELETE')
@endif
@if(session('success')) @endif @if(session('error')) @endif
@if($post->user && $post->user->getFirstMediaUrl('avatars', 'thumb')) {{ $post->user->name }} @else @endif

{{ __('Posted by') }} {{ $post->user->name ?? __('Unknown') }} · {{ $post->created_at->format('d-m-Y H:i') }} @if($post->pinned) {{ __('Pinned') }} @endif

@if($post->description)
{!! nl2br(e($post->description)) !!}
@endif
@if($documents->count() > 0)
{{ __('Attachments') }}
@foreach($documents as $document) {{ $document->file_name }} {{ round($document->size / 1024) }} KB @endforeach
@endif
{{ __('Comments') }} ({{ $post->comments->count() }})
@forelse($post->comments as $comment)
@if($comment->user && $comment->user->getFirstMediaUrl('avatars', 'thumb')) {{ $comment->user->name }} @else @endif
{{ $comment->user->name ?? __('Unknown') }} {{ $comment->created_at->diffForHumans() }}
@if($comment->user_id === Auth::user()->id || Auth::user()->hasRole('admin'))
@csrf @method('DELETE')
@endif

{!! nl2br(e($comment->body)) !!}

@empty

{{ __('No comments yet. Be the first to comment!') }}

@endforelse
{{ __('Add Comment') }}
@csrf
@error('body')
{{ $message }}
@enderror
@endsection