arispati / laravel-dispatch-id
Laravel package to get the job id after dispatch
v0.1.0
2021-10-15 11:50 UTC
Requires
- php: >=7.2
- illuminate/container: ~5.0|~6.0|~7.0|^8.0
- illuminate/contracts: ~5.0|~6.0|~7.0|^8.0
README
Laravel package to get the job id after dispatch
Description
This package is very useful when you need the job id after dispatch and use it for other logic
How to Install
- Install with composer
composer require arispati/laravel-dispatch-id
How to Use
- Using class
use Arispati\LaravelDispatchId\Event; use App\Jobs\TestJob; // Basic dispatch $jobId = Event::dispatch(new TestJob()); // Advanced dispatch $job = (new TestJob())->delay(now()->addMinutes(10)) ->onConnection('connection') ->onQueue('queue'); $jobId = Event::dispatch($job);
- Using helper function
use App\Jobs\TestJob; // Basic dispatch $jobId = dispatch_id(new TestJob()); // Advanced dispatch $job = (new TestJob())->delay(now()->addMinutes(10)) ->onConnection('connection') ->onQueue('queue'); $jobId = dispatch_id($job);