Not see the user name before the first reply
omidMolaverdi opened this issue · 3 comments
omidMolaverdi commented
Hi great folks.
Is there any easy way to hide the user name in the thread before the first reply?
cmgmyr commented
The blade files are just for example and sometimes to use as a starter. Feel free to add any logic you need to hide/show information.
omidMolaverdi commented
Thanks @cmgmyr. I have a bit of difficulty with the logic. do you have any recommendation please?
cmgmyr commented
You could probably change this line to something like this.
@if($thread->messages->count() > 1)
<h5 class="media-heading">{{ $message->user->name }}</h5>
@endif
But I'd probably create a new variable in the controller and pass it to the views so you only need to make that calculation once.
// Controller
$shouldShowUserNames = $thread->messages->count() > 1;
// View
@if($shouldShowUserNames)
<h5 class="media-heading">{{ $message->user->name }}</h5>
@endif