Add user roles system

This commit is contained in:
2026-01-16 23:14:47 +01:00
parent c0be2e294a
commit e5ef197ed6
21 changed files with 206 additions and 85 deletions

View File

@@ -6,12 +6,16 @@
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-pink-700 dark:text-neutral-200 ">
<tr>
<th scope="col" class="px-6 py-3">
Discord-ID
ID
</th>
<th scope="col" class="px-6 py-3">
Discord ID
<input
class="w-4 h-4 ml-2 text-rose-600 bg-gray-100 border-gray-300 rounded focus:ring-rose-500 dark:focus:ring-rose-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
type="checkbox"
wire:model.live="filtered"
value="true"
wire:model.live.debounce.600ms="discordId"
type="search"
id="discord-search"
class="ml-2 w-32 h-7 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900 dark:border-neutral-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900"
placeholder="Search..."
>
</th>
<th scope="col" class="px-6 py-3">
@@ -59,14 +63,17 @@
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
{{ $user->id }}
</th>
<td class="px-6 py-4">
{{ $user->discord_id ?? 'n/a' }}
</td>
<td class="px-6 py-4">
{{ $user->name }}
</td>
<td class="px-6 py-4">
{{ $user->is_patreon ? 'Yes' : 'No' }}
{{ $user->hasRole(\App\Enums\UserRole::SUPPORTER) ? 'Yes' : 'No' }}
</td>
<td class="px-6 py-4">
{{ $user->is_banned ? 'Yes' : 'No' }}
{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'Yes' : 'No' }}
</td>
<td class="px-6 py-4">
{{ $user->created_at->format('Y-m-d') }}
@@ -78,9 +85,9 @@
<form method="POST" action="{{ route('admin.user.update') }}">
@csrf
<input type="hidden" value="{{ $user->id }}" name="id">
<input type="hidden" value="{{ $user->is_banned ? 'unban' : 'ban' }}" name="action">
<input type="hidden" value="{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'unban' : 'ban' }}" name="action">
<button type="submit" class="inline-block w-full rounded bg-rose-600 pl-[4px] pr-[4px] p-[1px] text-xs font-medium uppercase leading-normal text-white transition duration-150 ease-in-out hover:bg-rose-700 focus:bg-rose-600">
{{ $user->is_banned ? 'Unban' : 'Ban' }}
{{ $user->hasRole(\App\Enums\UserRole::BANNED) ? 'Unban' : 'Ban' }}
</button>
</form>
<button wire:click="deleteUserComments('{{ $user->id }}')" class="inline-block w-full rounded bg-red-600 pl-[4px] pr-[4px] p-[1px] text-xs font-medium uppercase leading-normal text-white transition duration-150 ease-in-out hover:bg-rose-700 focus:bg-rose-600">