Installation:
composer require moox/jobs
php artisan mooxjobs:install
php artisan moox:install handles everything.First Use Case:
/admin/jobs).SendEmailJob batch for a marketing campaign.Key Files to Review:
config/mooxjobs.php: Adjust queue connection, batch settings, or failed job retention.database/migrations/: Verify table structures for jobs, failed_jobs, and job_batches.Job Monitoring:
ProcessInvoiceJob failures with:
// In a Filament policy or query scope
public function scopeFailed($query) {
return $query->where('job', 'App\Jobs\ProcessInvoiceJob');
}
Batch Management:
use Moox\Jobs\Facades\Jobs;
$batch = Jobs::batch([
new SendEmailJob($user),
new LogActivityJob($user),
])->name('user-onboarding')->dispatch();
Failed Job Retries:
$failedJob = FailedJob::find($id);
$failedJob->retry();
Integration with Filament:
use Moox\Jobs\Filament\Widgets\JobsOverview;
Filament::registerWidget(JobsOverview::class);
Custom Job Columns: Override default columns in a service provider:
public function boot() {
Filament::serving(function () {
Filament::registerTableColumn(
'custom_column',
fn ($record) => $record->payload['custom_data']
);
});
}
Queue Listeners:
Hook into job events (e.g., JobProcessed) for analytics:
use Moox\Jobs\Events\JobProcessed;
event(new JobProcessed($job));
API Access: Expose job data via Filament’s API:
Route::get('/api/jobs', function () {
return Jobs::table()->get();
});
Redis Limitations:
database driver or sync Redis jobs to the database via a listener.Failed Job Retention:
mooxjobs.php).failed_jobs table.Batch Naming Collisions:
user-onboarding) will overwrite each other.$batch->name('user-onboarding-' . now()->timestamp);
Payload Size:
shouldQueue() with delay().Log Job Events:
Enable logging in mooxjobs.php:
'log_events' => true,
Check storage/logs/laravel.log for job lifecycle events.
Query Performance:
Add indexes to failed_jobs for large queues:
Schema::table('failed_jobs', function (Blueprint $table) {
$table->index('job');
$table->index('batch_id');
});
Filament Caching: Clear Filament’s cache after config changes:
php artisan filament:cache-clear
Custom Job Actions: Add buttons to the job table via a Filament plugin:
use Moox\Jobs\Filament\Resources\JobResource;
JobResource::registerAction(
Action::make('customAction')
->action(function (Job $job) { /* ... */ })
);
Override Views: Publish and modify Filament views:
php artisan vendor:publish --tag=mooxjobs-views
Edit resources/views/vendor/moox/jobs/....
Queue Worker Integration: Sync external queues (e.g., SQS) to Moox Jobs via a custom worker:
use Moox\Jobs\Facades\Jobs;
$worker = new ExternalQueueWorker();
$worker->process(function ($job) {
Jobs::table()->create([...]);
});
How can I help you explore Laravel packages today?