Installation
composer require mylaraveltools/panel
php artisan vendor:publish --provider="Mylaraveltools\Panel\PanelServiceProvider" --tag="panel-config"
php artisan migrate
config/panel.php for basic configuration (e.g., panel_name, theme, auth_driver).Basic Setup
php artisan vendor:publish --provider="Mylaraveltools\Panel\PanelServiceProvider" --tag="panel-views"
routes/web.php:
Route::panel(); // Default: `/panel`
First Use Case: Quick Dashboard
DashboardPanel) extending Mylaraveltools\Panel\Components\PanelComponent:
namespace App\Http\Livewire;
use Mylaraveltools\Panel\Components\PanelComponent;
class DashboardPanel extends PanelComponent
{
public function render()
{
return view('livewire.dashboard-panel', [
'stats' => $this->getStats(), // Example method
]);
}
}
config/panel.php under panels.dashboard.Define Panels in Config
// config/panel.php
'panels' => [
'dashboard' => [
'component' => \App\Http\Livewire\DashboardPanel::class,
'icon' => 'home',
'title' => 'Dashboard',
'order' => 1,
],
'users' => [
'component' => \App\Http\Livewire\UsersPanel::class,
'icon' => 'users',
'title' => 'User Management',
'order' => 2,
],
],
Livewire Integration
PanelComponent for shared functionality (e.g., auth checks, layout):
use Mylaraveltools\Panel\Traits\HasPanelPermissions;
class UsersPanel extends PanelComponent
{
use HasPanelPermissions;
public function rules()
{
return [
'view_users' => 'can:view-users',
];
}
}
php artisan make:livewire Admin/PostsPanel
PanelComponent
namespace App\Http\Livewire\Admin;
use Mylaraveltools\Panel\Components\PanelComponent;
class PostsPanel extends PanelComponent
{
public function render()
{
return view('livewire.admin.posts-panel', [
'posts' => Post::latest()->get(),
]);
}
}
'posts' => [
'component' => \App\Http\Livewire\Admin\PostsPanel::class,
'icon' => 'file-alt',
'title' => 'Posts',
'order' => 3,
'middleware' => ['verified'], // Optional
],
/panel/postspanel-* utilities (e.g., panel-bg-gray-800, panel-text-white).resources/css/panel.css:
@layer components.panel {
.panel-header {
@apply bg-gray-700;
}
}
Route Caching Conflicts
php artisan route:clear
Route::panel().Livewire Component Not Found
config/panel.php matches the autoloaded class.composer dump-autoload if classes aren’t resolved.Permission Traits Not Loading
HasPanelPermissions is used in the component and the rules() method is defined.config/panel.php for auth_driver (e.g., spatie-permission).Tailwind Conflicts
@tailwindcss/directives is in resources/css/app.css and the panel layer is included:
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components.panel { ... }
Panel Not Showing?
storage/logs/laravel.log for missing component errors.config/panel.php with a valid order value.Livewire Updates Not Triggering
$this->emit('refreshPanel') in parent component methods to force UI updates.Auth Issues
php artisan panel:auth to generate a test user if using auth_driver: 'panel'.Custom Layouts Override the default panel layout by publishing views:
php artisan vendor:publish --tag="panel-views" --force
Then modify resources/views/vendor/panel/layouts/app.blade.php.
Dynamic Panel Loading
Use the PanelService to fetch panels programmatically:
use Mylaraveltools\Panel\Facades\Panel;
$panels = Panel::getPanels(); // Returns array of configured panels
Multi-Tenancy
Extend the PanelService to filter panels by tenant:
Panel::getPanels()->where('tenant_id', auth()->tenant()->id);
Dark Mode Enable via config:
'theme' => [
'dark_mode' => true,
'dark_class' => 'dark',
],
Then use dark: variants in Tailwind (e.g., dark:bg-gray-900).
How can I help you explore Laravel packages today?