@forelse($messages as $msg)
@php
$isSecret = $msg->secret == 1;
$isToMe = Auth::check() && $msg->towho === Auth::user()->username;
$isFromMe = Auth::check() && $msg->who === Auth::user()->username;
@endphp
{{-- 消息卡片 --}}
{{-- 卡片头部:发件人 / 收件人 / 时间 --}}
{{-- 正文内容 --}}
{{-- 回复TA按钒 --}}
@if (!Auth::check() || $msg->who !== Auth::user()->username)
@endif
@empty
{{-- 发件人头像占位 --}}
{{ mb_substr($msg->who, 0, 1) }}
{{ $msg->who }}
向
{{ $msg->towho ?: '大家' }}
@if ($isSecret)
🔒
您您话
@endif
{{ \Carbon\Carbon::parse($msg->post_time)->diffForHumans() }}
@if ($isFromMe || $isToMe || (Auth::check() && Auth::user()->user_level >= 15))
@endif
{!! nl2br(e($msg->text_body)) !!}
📭
@endforelse
{{-- 分页 --}}
暂无信件
这里是空空如也的荒原。
{{ $messages->links() }}