diff --git a/resources/views/guestbook/index.blade.php b/resources/views/guestbook/index.blade.php index b8794bf..a7faeea 100644 --- a/resources/views/guestbook/index.blade.php +++ b/resources/views/guestbook/index.blade.php @@ -24,215 +24,216 @@ -@section('body-data', "x-data=\"{ showWriteForm: false, towho: '{{ $defaultTo }}' }\"") - @section('content') - {{-- 验证错误信息 --}} - @if (isset($errors) && $errors->any()) -
- -
- @endif - - {{-- 写信/留言表单区 (Alpine 控制显隐) --}} -
-
-
- @csrf -
-
- - -
-
- -
-
- -
- - -
- -
- -
-
-
-
- - {{-- 主体内容区 --}} -
- - {{-- 左侧:分类导航 --}} - - {{-- 移动端悬浮写留言按钮 --}} - + {{-- 主体内容区 --}} +
- {{-- 移动端底部分类栏 --}} -
- - 🌍 - 公共墙 - - - 📥 - 收件箱 - - - 📤 - 发件箱 - + {{-- 左侧:分类导航 --}} + + + {{-- 右侧:留言流列表 --}} +
+
+ + @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 + +
+ + @if ($isSecret) +
+ 🔒 私密信件 +
+ @endif + +
+
+ {{ $msg->who }} + + {{ $msg->towho ?: '大家' }} + 留言: +
+
+ {{ \Carbon\Carbon::parse($msg->post_time)->diffForHumans() }} + + @if ($isFromMe || $isToMe || (Auth::check() && Auth::user()->user_level >= 15)) +
+ @csrf + @method('DELETE') + +
+ @endif +
+
+ +
+ {!! nl2br(e($msg->text_body)) !!} +
+ + @if (!Auth::check() || $msg->who !== Auth::user()->username) +
+ +
+ @endif +
+ @empty +
+ 📭 +

暂无信件

+

这里是空空如也的荒原。

+ +
+ @endforelse + + {{-- 分页 --}} +
+ {{ $messages->links() }} +
+ +
+
+
+ + {{-- 移动端悬浮写留言按钮 --}} + + + {{-- 移动端底部分类栏 --}} +
@endsection