PHP code example of lancodev / filament-meilisearch

1. Go to this page and download the library: Download lancodev/filament-meilisearch 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/ */

    

lancodev / filament-meilisearch example snippets


return [
    'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
    'key' => env('MEILISEARCH_KEY', null),
    
    'navigation' => [
        'group' => 'Meilisearch',
        'icon' => 'heroicon-o-magnifying-glass',
        'sort' => 0,
    ],
    
    'features' => [
        'indexes' => true,
        'documents' => true,
        'keys' => true,
        'tasks' => true,
        'dumps' => true,
        'snapshots' => true,
        'settings' => true,
    ],
];

use Lancodev\FilamentMeilisearch\MeilisearchPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            MeilisearchPlugin::make()
                ->navigationGroup('Search')
                ->navigationIcon('heroicon-o-magnifying-glass')
                ->navigationSort(10)
                ->features([
                    'indexes' => true,
                    'documents' => true,
                    'keys' => true,
                    'tasks' => true,
                    'dumps' => true,
                    'snapshots' => true,
                    'settings' => true,
                ]),
        ]);
}

MeilisearchPlugin::make()
    ->features([
        'indexes' => true,
        'documents' => true,
        'keys' => false,      // Disable API keys management
        'tasks' => true,
        'dumps' => false,     // Disable dumps
        'snapshots' => false, // Disable snapshots
        'settings' => true,
    ])

MeilisearchPlugin::make()
    ->allowedIndexes(['products', 'users', 'orders']);

// config/filament-meilisearch.php
'allowed_indexes' => ['products', 'users', 'orders'],
bash
php artisan vendor:publish --tag="filament-meilisearch-config"