### Install package with Composer Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/README.md Install the package via Composer. Requires PHP 8.2+, Laravel 11.0+, and Filament 5.0. ```bash composer require jeffersongoncalves/filament-one-time-operations ``` -------------------------------- ### Run tests Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### Publish config file Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/README.md Publish the package configuration file. ```bash php artisan vendor:publish --tag=filament-one-time-operations-config ``` -------------------------------- ### Create and Process One-Time Operations Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Commands to create a new one-time operation file and run pending operations. The operations are managed by the underlying timokoerber/laravel-one-time-operations package. ```bash php artisan operations:make MyDataMigration ``` ```bash php artisan operations:process ``` -------------------------------- ### Register plugin in AdminPanelProvider.php Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/README.md Register the plugin in AdminPanelProvider.php by adding the import and the plugin call within the plugins array. ```php use JeffersonGoncalves\Filament\OneTimeOperations\OneTimeOperationsPlugin; ->plugins([ OneTimeOperationsPlugin::make(), ]) ``` -------------------------------- ### Custom OperationResource and Panel Registration Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Create a custom OperationResource extending the base resource and register it in the panel provider. The plugin detects the existing resource and skips auto-registration. ```php namespace App\Filament\Resources; use JeffersonGoncalves\Filament\OneTimeOperations\Resources\OperationResource as BaseResource; class OperationResource extends BaseResource { // Override table(), infolist(), getPages(), etc. } ``` ```php $panel->resources([ \App\Filament\Resources\OperationResource::class, ]); ``` -------------------------------- ### Utils support class definition Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Provides static helper methods for the resource, all reading from the filament-one-time-operations config file. Centralizes configuration access for the resource. ```php namespace JeffersonGoncalves\Filament\OneTimeOperations\Support; class Utils { public static function isResourcePublished(Panel $panel): bool; public static function getResourceCluster(): ?string; public static function getOperationModel(): string; public static function isResourceNavigationRegistered(): bool; public static function isResourceNavigationGroupEnabled(): bool; public static function getResourceNavigationSort(): ?int; public static function getResourceNavigationIcon(): string; public static function getResourceSlug(): string; public static function isResourceNavigationBadgeEnabled(): bool; } ``` -------------------------------- ### Configure operations resource in filament-one-time-operations.php Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Return this array from the config file to customize the operations resource: cluster, model, navigation, icon, sort, and slug. The model defaults to TimoKoerber's Operation class. ```php use TimoKoerber\LaravelOneTimeOperations\Models\Operation; return [ 'operation_resource' => [ 'cluster' => null, // Resource cluster class (string|null) 'model' => Operation::class, // Eloquent model for operations 'should_register_navigation' => true, // Show in navigation 'navigation_badge' => true, // Show count badge 'navigation_icon' => 'heroicon-o-queue-list', // Navigation icon 'navigation_sort' => -1, // Navigation sort order 'slug' => 'settings/operation', // URL slug ], ]; ``` -------------------------------- ### Register OneTimeOperationsPlugin in Filament panel Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Add the plugin to a Filament panel's plugins array. Requires importing the plugin class and adding it inside the panel() method. ```php use JeffersonGoncalves\Filament\OneTimeOperations\OneTimeOperationsPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ OneTimeOperationsPlugin::make(), ]); } ``` -------------------------------- ### Custom Model Configuration Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Configuration to use a custom model for the operation resource. Update the config file to point to your custom Eloquent model. ```php 'operation_resource' => [ 'model' => \App\Models\CustomOperation::class, ], ``` -------------------------------- ### ViewOperation page class definition Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Defines the view page for a single operation record, binding to OperationResource. ```php namespace JeffersonGoncalves\Filament\OneTimeOperations\Resources\OperationResource\Pages; use Filament\Resources\Pages\ViewRecord; class ViewOperation extends ViewRecord { protected static string $resource = OperationResource::class; } ``` -------------------------------- ### ListOperations page class definition Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Defines the list page for operations. Provides tabs for all, async, and sync operations based on the dispatched attribute. ```php namespace JeffersonGoncalves\Filament\OneTimeOperations\Resources\OperationResource\Pages; use Filament\Resources\Pages\ListRecords; class ListOperations extends ListRecords { // Tabs: all, async (dispatched=async), sync (dispatched=sync) public function getTabs(): array; } ``` -------------------------------- ### OperationResource class definition Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Defines the Filament resource for operations. Methods read from config for model, cluster, slug, navigation icon, sort, badge, and group. Table columns include name, dispatched, and processed_at; filters include dispatched; actions include ViewAction. ```php namespace JeffersonGoncalves\Filament\OneTimeOperations\Resources; use Filament\Resources\Resource; use TimoKoerber\LaravelOneTimeOperations\Models\Operation; class OperationResource extends Resource { public static function getModel(): string; // from config public static function getCluster(): ?string; // from config public static function getSlug(): string; // from config public static function getNavigationIcon(): string; // from config public static function getNavigationSort(): ?int; // from config public static function getNavigationBadge(): ?string; // operation count public static function shouldRegisterNavigation(): bool; public static function getNavigationGroup(): ?string; } ``` -------------------------------- ### OneTimeOperationsPlugin class definition Source: https://github.com/jeffersongoncalves/filament-one-time-operations/blob/3.x/resources/boost/skills/filament-one-time-operations-development/SKILL.md Defines the plugin class implementing Filament's Plugin contract. The register method auto-registers OperationResource if not already present, and getId returns 'filament-one-time-operations'. ```php namespace JeffersonGoncalves\Filament\OneTimeOperations; use Filament\Contracts\Plugin; use Filament\Panel; class OneTimeOperationsPlugin implements Plugin { public static function make(): static; public function getId(): string; // returns 'filament-one-time-operations' public function register(Panel $panel): void; // auto-registers OperationResource if not already present public function boot(Panel $panel): void; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.