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
CodePudding user response:
You can dispatch the job in the trait using:
CreateFact::dispatch($entries);