PHP code example of schmeits / filament-pan-analytics-widget

1. Go to this page and download the library: Download schmeits/filament-pan-analytics-widget 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/ */

    

schmeits / filament-pan-analytics-widget example snippets


use Schmeits\FilamentPanAnalyticsWidget\FilamentPanAnalyticsWidgetPlugin;
use Schmeits\FilamentPanAnalyticsWidget\Widgets\PanAnalyticsTableWidget;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentPanAnalyticsWidgetPlugin::make())
        ->widgets([
            PanAnalyticsTableWidget::class,
        ]);
}

FilamentPanAnalyticsWidgetPlugin::make()
    // Show a search field for the name column.
    ->searchable()
    // Decide who may see the widget. Everyone with access to the panel sees it by default.
    ->authorize(fn (): bool => auth()->user()?->can('viewAnalytics') ?? false)
bash
php artisan vendor:publish --tag="filament-pan-analytics-widget-translations"