This commit is contained in:
2025-08-16 15:38:07 +03:00
parent 11dabec67e
commit d709de39dc
7 changed files with 154 additions and 84 deletions
+15 -11
View File
@@ -10,7 +10,7 @@
<div class="row">
<div class="col-md-12">
{{ $topic->name }} <br>
<small>Created by {{ $topic->author->name }} | {{ $topic->created_at->diffForHumans() }}</small>
<small>Created by {{ $topic->author->name ?? 'Unknown User' }} | {{ $topic->created_at ? $topic->created_at->diffForHumans() : 'N/A' }}</small>
</div>
</div>
</h1>
@@ -20,13 +20,17 @@
<div class="row post-row">
<div class="col-md-1">
<div class="text-center">
<img src="{{ $post->author->avatar ?? 'https://ui-avatars.com/api/?name=' . urlencode($post->author->name) }}"
alt="{{ $post->author->name }}"
class="rounded-circle"
width="64"
@php
$authorName = $post->author->name ?? 'Unknown User';
$avatarUrl = $post->author->avatar ?? 'https://ui-avatars.com/api/?name=' . urlencode($authorName);
@endphp
<img src="{{ $avatarUrl }}"
alt="{{ $authorName }}"
class="rounded-circle"
width="64"
height="64">
<div class="mt-2">
<small>{{ $post->author->name }}</small>
<small>{{ $authorName }}</small>
</div>
</div>
</div>
@@ -35,7 +39,7 @@
{!! $post->content !!}
</div>
<div class="post-meta">
<small>Posted {{ $post->created_at->diffForHumans() }}</small>
<small>Posted {{ $post->created_at ? $post->created_at->diffForHumans() : 'N/A' }}</small>
<div class="float-end">
<a href="#" class="btn btn-primary btn-sm">Reply</a>
<a href="#" class="btn btn-secondary btn-sm">Like</a>
@@ -51,7 +55,7 @@
</div>
{{ $posts->links() }}
<hr>
<form action="{{ route('forums.thread.topics.post.store', [$thread->category->slug, $thread->slug, $topic->slug]) }}" method="POST">
<form action="{{ route('forums.thread.topics.post.store', [$thread->category->slug ?? 'unknown', $thread->slug, $topic->slug]) }}" method="POST">
@csrf
<div class="form-group">
<x-easy-mde name="content" />
@@ -80,7 +84,7 @@
</li>
<li class="mb-2">
<span class="iconify me-1" data-icon="mdi-clock-outline"></span>
Created: {{ $topic->created_at->diffForHumans() }}
Created: {{ $topic->created_at ? $topic->created_at->diffForHumans() : 'N/A' }}
</li>
</ul>
</div>
@@ -93,8 +97,8 @@
<ul class="list-unstyled">
@foreach($similarTopics as $similarTopic)
<li class="mb-2">
<a href="{{ route('forums.thread.topics.show', [$thread->category->slug, $thread->slug, $similarTopic->slug]) }}">
{{ $similarTopic->name }}
<a href="{{ route('forums.thread.topics.show', [$thread->category->slug ?? 'unknown', $thread->slug, $similarTopic->slug]) }}">
{{ $similarTopic->name ?? 'Unnamed Topic' }}
</a>
</li>
@endforeach