### Install laravel-queue-management with Composer Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Install the package via Composer. Laravel's auto-discovery registers the service provider and the QueueManagement facade automatically. ```bash composer require jeffersongoncalves/laravel-queue-management ``` -------------------------------- ### Run tests with composer test Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Run the package's test suite. ```bash composer test ``` -------------------------------- ### Configure queue table mappings Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Configuration file (config/queue-management.php) that maps the queue table names. Customize the values if your application uses different table names. ```php return [ 'tables' => [ 'jobs' => 'jobs', 'failed_jobs' => 'failed_jobs', 'job_batches' => 'job_batches', ], ]; ``` -------------------------------- ### Publish queue-management config Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Publish the optional configuration file. The package reads from Laravel's existing queue tables and does not ship migrations, so ensure the built-in queue migrations have been run. ```bash php artisan vendor:publish --tag=queue-management-config ``` -------------------------------- ### Use QueueManagement facade Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Use the QueueManagement facade to access the same operations as the service layer: retry, retryAll, forget, flush, and deletePendingJob. ```php use JeffersonGoncalves\QueueManagement\Facades\QueueManagement; QueueManagement::retry(1, 2, 3); QueueManagement::retryAll(); QueueManagement::forget(1); QueueManagement::flush(); QueueManagement::deletePendingJob(10); ``` -------------------------------- ### Use QueueManager service methods Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Resolve the QueueManager from the container and use its methods to retry, forget, flush failed jobs, and delete pending jobs. The retry method accepts failed_jobs ids; if the queue.failed.driver is 'database-uuids', uuids are used automatically. ```php use JeffersonGoncalves\QueueManagement\QueueManager; $manager = app(QueueManager::class); // Retry one or more failed jobs (by failed_jobs.id). // When queue.failed.driver is "database-uuids" the uuid is used automatically. $manager->retry(1, 2, 3); // Retry every failed job $manager->retryAll(); // Forget a single failed job by id or uuid $manager->forget(1); // Flush all failed jobs $manager->flush(); // Delete a pending job from the jobs table by id $manager->deletePendingJob(10); ``` -------------------------------- ### Use Eloquent models for queue tables Source: https://github.com/jeffersongoncalves/laravel-queue-management/blob/master/README.md Eloquent models for the jobs, failed_jobs, and job_batches tables. Access attributes like displayName, maxTries, delay, failed_at (Carbon instance), and options (base64 decoded). ```php use JeffersonGoncalves\QueueManagement\Models\Job; use JeffersonGoncalves\QueueManagement\Models\FailedJob; use JeffersonGoncalves\QueueManagement\Models\JobBatch; // Pending jobs $pending = Job::query()->get(); $first = $pending->first(); $first->displayName; // e.g. "App\Jobs\SendEmail" $first->maxTries; // int $first->delay; // int // Failed jobs $failed = FailedJob::query()->get(); $failed->first()->failed_at; // Carbon instance // Job batches (options are transparently base64 decoded) $batches = JobBatch::query()->get(); $batches->first()->options; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.