vormiaphp/ui-livewireflux-admin
Laravel admin panel package for Vormia apps with Livewire 4 + Flux. Ships prebuilt routes, views, and Livewire components for managing categories, inheritance, locations, availability, and admin users, plus automatic sidebar integration and role assignment support.
## Getting Started
### Minimal Steps to First Use
1. **Install the package** via Composer:
```bash
composer require vormiaphp/ui-livewireflux-admin
php artisan ui-livewireflux-admin:install
routes/web.php for injected admin routes under auth middleware.AdminPanel component exists in app/View/Components/AdminPanel.php./admin in your browser (ensure you’re logged in as an admin)./admin/categories.resources/views/livewire/admin/control/categories/index.blade.php) handles CRUD operations out-of-the-box.<x-admin-panel> component in your Blade views for consistent admin layouts:
<x-admin-panel
header="Categories"
desc="Manage your categories"
:button="$createButton"
>
@livewire('admin.control.categories.index')
</x-admin-panel>
Admin Panel Layouts
<x-admin-panel> for consistent headers, descriptions, and action buttons.<x-admin-panel
header="Locations"
desc="Manage countries and cities"
:button="$createCountryButton"
>
@livewire('admin.control.locations.index')
</x-admin-panel>
Livewire Component Integration
app/Livewire/Admin/ and modifying.edit form for categories:
// app/Livewire/Admin/Control/Categories/Edit.php
namespace App\Livewire\Admin\Control\Categories;
use Vormia\UI\LivewireFlux\Admin\Control\Categories\Edit as BaseEdit;
class Edit extends BaseEdit {
public function updatedCustomField($value) {
// Custom logic
}
}
Sidebar Menu Injection
vendor/vormiaphp/ui-livewireflux-admin/src/stubs/reference/sidebar-menu-to-add.blade.php inside:
<flux:sidebar.group :heading="__('Platform')">
<!-- Existing items -->
<!-- PASTE ADMIN MENU ITEMS HERE -->
</flux:sidebar.group>
Role-Based Access Control (RBAC)
Role model (Vormia\Vormia\Models\Role) to assign permissions.$user = User::create([...]);
$superAdminRole = Role::where('name', 'super-admin')->first();
$user->roles()->attach($superAdminRole);
Customizing Fortify Actions
EnsureUserIsActive.php) to app/Actions/Fortify/.Extending Livewire Components
resources/views/livewire/admin/control/categories/index.blade.php) to app/Livewire/Admin/Control/Categories/ and modify.Adding Custom Admin Sections
app/Livewire/Admin/CustomSection/Index.php).routes/web.php:
Route::get('/admin/custom-section', [CustomSectionIndex::class, 'index'])->name('admin.custom-section.index');
<flux:sidebar.item icon="cog" :href="route('admin.custom-section.index')" wire:navigate>
{{ __('Custom Section') }}
</flux:sidebar.item>
Working with Vormia Models
Category, Country, City).Flux-Specific Patterns
wire:navigate for smooth transitions between admin pages.flux:sidebar and flux:alert components for consistent UI.Volt Templates (Livewire 4)
@props, @bind, @entangle).<input type="text" wire:model="name" @bind="name">
File Overwrites During Updates
php artisan ui-livewireflux-admin:update will overwrite your customizations.app/ (e.g., app/Livewire/Admin/) before updating.Missing Sidebar Injection
resources/views/components/sidebar.blade.php).reference/ folder.Route Injection Failures
routes/web.php lacks the auth middleware group.vendor/vormiaphp/ui-livewireflux-admin/src/stubs/reference/routes-to-add.php.Fortify Migration Conflicts
--force to republish Fortify support stubs:
php artisan vendor:publish --tag=fortify-support --force
Volt vs. Blade Confusion
@if vs. @endif in Volt).{{ }} for output in Volt (same as Blade).Role Assignment Issues
Role model is correctly referenced (Vormia\Vormia\Models\Role).Role::all(); // Should return roles like 'user', 'admin', 'super-admin'
Livewire Component Not Found
admin.control.categories.index) isn’t loading, verify:
resources/views/livewire/admin/control/categories/index.blade.php.Check Installed Files
ls app/View/Components/AdminPanel.php
ls resources/views/livewire/admin/
Clear Caches
php artisan optimize:clear
php artisan view:clear
Enable Livewire Debugging
.env:
LIVEWIRE_DEBUG=true
storage/logs/livewire.php
Inspect Flux Sidebar
<flux:sidebar.group :heading="Platform">. Ensure the admin menu items are inside this group.Test Routes Manually
php artisan route:list | grep admin
/admin/categories).Custom AdminPanel Component
app/View/Components/AdminPanel.php to add props or logic:
public function __construct(
public string $header,
public string $desc,
public View|string $button,
public ?string $icon = 'cog'
) {}
Hook into Livewire Lifecycle
mount(), updatedProperty()):
protected function mount() {
$this->customData = 'default';
}
Override Fortify Actions
app/Actions/Fortify/EnsureUserIsActive.php to add custom validation:How can I help you explore Laravel packages today?