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:
@@ -44,7 +44,8 @@
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||
@click.prevent="console.log('Button clicked'); $dispatch('open-quick-switcher')"
|
||||
x-data
|
||||
@click.prevent="$dispatch('open-quick-switcher')"
|
||||
>
|
||||
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
@@ -76,6 +77,16 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
|
||||
<a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Profile
|
||||
</a>
|
||||
@if(Auth::user()->isAdmin())
|
||||
<a href="{{ route('admin.users.index') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
<span class="flex items-center">
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path>
|
||||
</svg>
|
||||
ユーザー管理
|
||||
</span>
|
||||
</a>
|
||||
@endif
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit" class="w-full text-left block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
|
||||
Reference in New Issue
Block a user