Discussion Details

@if ($post->user->profile_picture) User Avatar @else @php $colors = ['bg-blue-500', 'bg-green-500', 'bg-red-500', 'bg-yellow-500', 'bg-purple-500', 'bg-pink-500', 'bg-indigo-500']; $colorIndex = crc32($post->user->name) % count($colors); $selectedColor = $colors[$colorIndex]; $nameParts = explode(' ', $post->user->name); $initials = count($nameParts) > 1 ? strtoupper(substr($nameParts[0], 0, 1)) . strtoupper(substr(end($nameParts), 0, 1)) : strtoupper(substr($nameParts[0], 0, 1)); @endphp
{{ $initials }}
@endif
@{{ $post->user->username }}

{{ $post->title }}

{!! $post->body !!}

{{ $post->created_at->diffForHumans() }}
{{ $post->comments_count }} Comments

Replies:

@foreach ($post->comments as $comment)
@if ($comment->user->profile_picture) User Avatar @else @php $colors = ['bg-blue-500', 'bg-green-500', 'bg-red-500', 'bg-yellow-500', 'bg-purple-500', 'bg-pink-500', 'bg-indigo-500']; $colorIndex = crc32($comment->user->name) % count($colors); $selectedColor = $colors[$colorIndex]; $nameParts = explode(' ', $comment->user->name); $initials = count($nameParts) > 1 ? strtoupper(substr($nameParts[0], 0, 1)) . strtoupper(substr(end($nameParts), 0, 1)) : strtoupper(substr($nameParts[0], 0, 1)); @endphp
{{ $initials }}
@endif

{{ $comment->body }}

Answered by {{ '@'.$comment->user->username }} {{ $comment->created_at->diffForHumans() }}
@if(count($comment->replies) > 0)

Replies

@endif @foreach ($comment->replies as $reply)
User Avatar

{{ $reply->body }}

Replied by {{ '@'.$reply->user->username }} {{ $reply->created_at->diffForHumans() }}
@endforeach
@endforeach

Reply

@section('sidebar')

Contact Information

Email: info@yourapp.com

Phone: +1234567890

@endsection