Add admin user management and improve UX

Features:
- Add user management for admins (CRUD operations)
- Add is_admin column to users table
- Add AdminMiddleware for authorization
- Add admin routes and views
- Add artisan command: user:set-admin

Improvements:
- Fix Quick Switcher: add x-data for Alpine.js dispatch
- Fix Quick Switcher: close on outside click
- Redirect non-admin users to front page after login
- Add Knowledge Base link in dashboard navigation
- Change app logo from Laravel to book icon
This commit is contained in:
2025-11-29 11:08:17 +09:00
parent 6e7f8566ef
commit c11c05b3ea
15 changed files with 543 additions and 12 deletions

View File

@@ -15,6 +15,12 @@
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
<x-nav-link href="/" :active="false">
<svg class="w-4 h-4 mr-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"></path>
</svg>
{{ __('Knowledge Base') }}
</x-nav-link>
</div>
</div>
@@ -38,6 +44,12 @@
{{ __('Profile') }}
</x-dropdown-link>
@if(Auth::user()->isAdmin())
<x-dropdown-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }}
</x-dropdown-link>
@endif
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
@@ -70,6 +82,9 @@
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
<x-responsive-nav-link href="/" :active="false">
{{ __('Knowledge Base') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
@@ -84,6 +99,12 @@
{{ __('Profile') }}
</x-responsive-nav-link>
@if(Auth::user()->isAdmin())
<x-responsive-nav-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }}
</x-responsive-nav-link>
@endif
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf