croustibat/filament-jobs-monitor
Installation:
composer require croustibat/filament-jobs-monitor
php artisan vendor:publish --tag="filament-jobs-monitor-migrations"
php artisan migrate
Verify your FilamentPHP version matches the package requirements (check README table).
Register the Plugin:
Add to app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
\Croustibat\FilamentJobsMonitor\Plugin::make(),
]);
}
First Use Case:
Dispatch a job (e.g., php artisan queue:work) and navigate to the Jobs Monitor plugin in Filament. Observe real-time job statuses (queued, processing, failed).
Job Dispatching & Tracking:
dispatch(), dispatchNow()).Illuminate\Queue\Events\JobProcessed and JobFailed listeners (no manual instrumentation needed).Queue Configuration:
config/queue.php and the plugin’s migrations are up-to-date.Filament Integration:
'resources' => ['enabled' => true],
Real-Time Updates:
Croustibat\FilamentJobsMonitor\Contracts\JobMonitor).job:updated event listener to refresh the UI dynamically.Job Metadata:
Job model or using the job:monitoring event:
// app/Providers/EventServiceProvider.php
public function boot()
{
event(new \Croustibat\FilamentJobsMonitor\Events\JobMonitoring(
$job,
$payload
));
}
Custom Job Columns: Override the table columns in a Filament service provider:
public function register()
{
FilamentJobsMonitor::tableColumns(function (Table $table) {
$table->columns([
Tables\Columns\TextColumn::make('custom_field')
->label('Custom Data'),
]);
});
}
Queue Worker Monitoring:
Worker model or using the worker:monitoring event.Bulk Actions:
FilamentJobsMonitor::tableActions([
Tables\Actions\Action::make('retry')
->action(function (Job $job) { $job->release(); }),
]);
API Access:
Route::get('/api/jobs', [FilamentJobsMonitor::class, 'getJobs']);
Migration Conflicts:
php artisan vendor:publish --tag="filament-jobs-monitor-migrations" --force
config/filament-jobs-monitor.php:
'migrations' => ['run' => false],
Job Data Lag:
php artisan queue:flush to reprocess old jobs (if needed).Performance:
per_page in config.failed_jobs and jobs tables:
ALTER TABLE jobs ADD INDEX (queue);
ALTER TABLE failed_jobs ADD INDEX (queue);
Driver-Specific Quirks:
config/queue.php.failed_jobs table size or archive old jobs:
// config/filament-jobs-monitor.php
'failed_jobs_ttl' => 30, // Days to retain failed jobs
Missing Jobs:
queue table is being written to (check jobs table).queue:failed table exists (for failed jobs).Plugin Not Showing:
php artisan filament:cache:clear
Event Listeners:
// app/Providers/EventServiceProvider.php
protected $listen = [
'Illuminate\Queue\Events\JobProcessed' => [
\Croustibat\FilamentJobsMonitor\Listeners\LogJob::class,
],
'Illuminate\Queue\Events\JobFailed' => [
\Croustibat\FilamentJobsMonitor\Listeners\LogFailedJob::class,
],
];
Custom Job Models:
Extend the Job model to add fields:
class CustomJob extends \Croustibat\FilamentJobsMonitor\Models\Job
{
protected $casts = [
'custom_data' => 'array',
];
}
Update the config to use your model:
'model' => \App\Models\CustomJob::class,
Hooks:
job:processing event to log custom data.resources/views/vendor/filament-jobs-monitor/.Testing:
$job = \Croustibat\FilamentJobsMonitor\Models\Job::factory()->create([
'queue' => 'test',
'payload' => ['command' => 'TestJob'],
]);
Localization:
// lang/en/filament-jobs-monitor.php
return [
'job' => [
'status' => [
'processing' => 'In Progress',
],
],
];
How can I help you explore Laravel packages today?