I want to use a job in a trait. Lumen give me following error: Call to undefined method App\Consumers\Journal::dispatch() this is my code
use App\Jobs\CreateFact;
trait Ledger
{
private function save() {
$this->dispatch(new CreateFact($entries));
}
}
Please help to resolve with issue. I am new in lumen
You can dispatch the job in the trait using:
CreateFact::dispatch($entries);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.