@extends('admin.layouts.app') @section('title', '用户检索与管理') @section('content')
重置
@php /** * 生成排序链接:点击同一列切换方向,点击新列默认倒序 */ $sortLink = function (string $col) use ($sortBy, $sortDir): string { $newDir = $sortBy === $col && $sortDir === 'desc' ? 'asc' : 'desc'; $qs = http_build_query( array_merge(request()->except(['sort_by', 'sort_dir', 'page']), [ 'sort_by' => $col, 'sort_dir' => $newDir, ]), ); return url('/admin/users?' . $qs); }; $arrow = fn(string $col): string => $sortBy === $col ? ($sortDir === 'desc' ? ' ↓' : ' ↑') : ''; @endphp @foreach ($users as $user) @endforeach
ID{{ $arrow('id') }} 注册名 性别 等级{{ $arrow('user_level') }} 职务 经验{{ $arrow('exp_num') }} 金币{{ $arrow('jjb') }} 魅力{{ $arrow('meili') }} 注册时间 在线{{ $arrow('online') }} 管理操作
{{ $user->id }}
{{ $user->username }} @if ($user->isVip()) {{ $user->vipIcon() }} @endif
{{ [0 => '保密', 1 => '男', 2 => '女'][$user->sex] ?? '保密' }} LV.{{ $user->user_level }} @if ($user->activePosition) @php $pos = $user->activePosition->position; @endphp
{{ $pos->department->name }}
{{ $pos->icon }} {{ $pos->name }}
@else @endif
{{ number_format($user->exp_num ?? 0) }} {{ number_format($user->jjb ?? 0) }} {{ number_format($user->meili ?? 0) }} {{ $user->created_at->format('Y/m/d H:i') }} @php $isOnline = $onlineUsernames->contains($user->username); @endphp {{ $isOnline ? '在线' : '离线' }} @if (auth()->id() === 1)
@csrf @method('DELETE')
@else @endif
@if ($users->hasPages())
{{ $users->links() }}
@endif
@endsection