PHP code example of xuanpablo / filament-palette

1. Go to this page and download the library: Download xuanpablo/filament-palette library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xuanpablo / filament-palette example snippets


use Xuanpablo\CommandPalette\CommandPalettePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            CommandPalettePlugin::make(),
            // ...
        ]);
}

use Xuanpablo\CommandPalette\Support\CommandItem;

'custom_commands' => [
    fn () => [
        CommandItem::make('My Action', '/my-url', 'Custom'),

        // Richer item with a description (second line) and extra search keywords
        CommandItem::make('Billing', '/admin/billing')
            ->group('Finance')
            ->description('Manage invoices and payments')
            ->keywords(['invoices', 'payments', 'subscriptions']),

        // Action command: dispatches a browser event instead of navigating
        CommandItem::action('Toggle dark mode', 'toggle-theme', ['mode' => 'dark']),
    ],
],

#[\Livewire\Attributes\On('toggle-theme')]
public function toggleTheme(array $detail): void { /* … */ }
bash
php artisan vendor:publish --tag=filament-palette-config
bash
php artisan filament-palette:publish-views
bash
php artisan vendor:publish --tag=filament-palette-views
bash
php artisan vendor:publish --tag=filament-palette-translations