devletes/filament-pinnable-navigation
composer require devletes/filament-pinnable-navigation
Panel registration in app/Providers/Filament/AdminPanelProvider.php:
->plugin(PinnableNavigationPlugin::make())
php artisan vendor:publish --tag="pinnable-navigation-config".resources/views/vendor/filament-pinnable-navigation/.resources/js/filament-pinnable-navigation.js for customization hooks.Pinning Items:
Grouping Pinned Items:
'pinned_group_label' => 'Favorites',
Dynamic Updates:
PinnableNavigationService to programmatically manage pins:
use Devletes\FilamentPinnableNavigation\Facades\PinnableNavigation;
// Pin an item for the current user
PinnableNavigation::pin('dashboard');
// Unpin an item
PinnableNavigation::unpin('dashboard');
PinnableNavigationItem class to add custom logic:
use Devletes\FilamentPinnableNavigation\Contracts\PinnableNavigationItem;
class CustomNavigationItem implements PinnableNavigationItem {
public function isPinnable(): bool {
return true; // or false for non-pinnable items
}
}
->middleware([PinnableNavigationMiddleware::class])
'storage' => 'database',
Run migrations:
php artisan migrate
Session vs. Database Storage:
'storage' => 'database',
pinnable_navigation_items table exists after enabling database storage.Navigation Item Keys:
'dashboard'). Ensure keys are unique and stable.Plugin Registration:
->navigationItems([
NavigationItem::make('Dashboard', 'heroicon-o-home')
->url('/dashboard')
->icon('heroicon-o-home'),
])
->plugin(PinnableNavigationPlugin::make()),
Caching:
php artisan filament:cache-clear
pinnable_navigation_items table (if using database storage) or session data:
dd(session()->get('filament-pinnable-navigation'));
'debug' => true,
resources/views/vendor/filament-pinnable-navigation/ to debug rendering issues.Custom Pin Button: Override the pin icon or tooltip via config:
'pin_icon' => 'heroicon-o-star',
'pin_tooltip' => 'Add to Favorites',
'unpin_tooltip' => 'Remove from Favorites',
Event Listeners: Listen for pinning events to trigger custom logic (e.g., notifications):
use Devletes\FilamentPinnableNavigation\Events\ItemPinned;
ItemPinned::listen(function (ItemPinned $event) {
Log::info("Item pinned: {$event->itemKey}");
});
API Access: Expose pinned items via API for frontend frameworks:
Route::get('/api/pinned-items', function () {
return PinnableNavigation::getPinnedItems();
});
Multi-Tenant Support:
Use the tenant config option to scope pins to tenants:
'tenant' => true,
Ensure your User model includes a tenant_id column.
How can I help you explore Laravel packages today?