Files
git-course/resources/views/user/index.blade.php
2026-05-12 10:57:21 +08:00

65 lines
3.9 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Users') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Username</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse ($users as $user)
<tr class="odd:bg-white even:bg-gray-50">
<td class="px-4 py-3 text-sm text-gray-700">{{ $user->id }}</td>
<td class="px-4 py-3 text-sm text-gray-900">{{ $user->name }}</td>
<td class="px-4 py-3 text-sm text-gray-700">
@if ($user->username)
<a href="{{ route('author.show', $user->username) }}" class="font-medium text-indigo-600 hover:text-indigo-500">
{{ $user->username }}
</a>
@else
<span class="text-gray-400">{{ __('Not set') }}</span>
@endif
</td>
<td class="px-4 py-3 text-sm text-gray-700">{{ $user->email }}</td>
<td class="px-4 py-3 text-sm text-gray-700">{{ $user->created_at?->format('Y-m-d H:i') }}</td>
<td class="px-4 py-3 text-sm text-gray-700">
<a href="{{ route('user.edit', $user) }}" class="font-medium text-indigo-600 hover:text-indigo-500">
{{ __('Edit') }}
</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-6 text-sm text-center text-gray-500">
No users found.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-6">
{{ $users->links() }}
</div>
</div>
</div>
</div>
</div>
</x-app-layout>