PHP code example of happenv-com / filament-saved-views

1. Go to this page and download the library: Download happenv-com/filament-saved-views 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/ */

    

happenv-com / filament-saved-views example snippets


use Happenv\FilamentSavedViews\FilamentSavedViewsPlugin;

$panel->plugin(FilamentSavedViewsPlugin::make());

return [
    'table' => 'saved_views', // backing table
    'guard' => null,          // auth guard used to scope views (null = default)
    'icons' => [              // Heroicon enums by default
        'manager' => Heroicon::Eye,
        'delete'  => Heroicon::Trash,
        'save'    => Heroicon::ArrowDownTray,
        'update'  => Heroicon::ArrowPath,
        'item'    => Heroicon::Bookmark,
        'edit'    => Heroicon::Cog6Tooth,
        'reorder' => Heroicon::Bars2,
    ],
];

use Happenv\FilamentSavedViews\Models\SavedView;

$this->app->bind(SavedView::class, \App\Models\MySavedView::class);

use Happenv\FilamentSavedViews\FilamentSavedViewsPlugin;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel->plugin(FilamentSavedViewsPlugin::make());
}

use Happenv\FilamentSavedViews\Filament\Concerns\HasSavedViews;

class ListOrders extends ListRecords
{
    use HasSavedViews;
}

public function getSubNavigation(): array
{
    return $this->getSavedViewsNavigationItems();
}

use Happenv\FilamentSavedViews\Filament\Actions\SavedViewManagerAction;

SavedViewManagerAction::configureUsing(
    fn (SavedViewManagerAction $action) => $action->color('primary')->badgeColor('warning'),
);

use Happenv\FilamentSavedViews\Filament\Enums\SavedViewManagerLayout;
use Filament\Actions\Action;
use Filament\Tables\Table;

public function table(Table $table): Table
{
    return $table
        // Dropdown (default) or Modal / slide-over presentation.
        ->savedViewManagerLayout(SavedViewManagerLayout::Modal)
        // Customise the trigger button.
        ->savedViewManagerTriggerAction(fn (Action $action): Action => $action->slideOver())
        // Stage changes and 
bash
php artisan vendor:publish --tag="filament-saved-views-migrations"
php artisan migrate
bash
php artisan filament:assets
css
@source '../../../../vendor/happenv-com/filament-saved-views/resources/**/*.blade.php';
bash
php artisan vendor:publish --tag="filament-saved-views-config"
bash
php artisan vendor:publish --tag="filament-saved-views-views"
php artisan vendor:publish --tag="filament-saved-views-translations"