Issue
I have a job table, i am store class name in "job" field. I am trying call and run job class from database table.
This example works.
$class = \App\Models\BulkJobs::with('action')->first();
app($class->action->job)->dispatch();
When I call without a construct the job goes into the queue. When i pass a parameter job dispatch function, job give me a error.
Unresolvable dependency resolving [Parameter #0 [ $property]] in class App\Jobs\Bulk\SetCategoriesToCartJob
app($class->action->job)->dispatch('some property');
//OR
app($class->action->job)::dispatch('some property');
$class->action->job->dispatch('some property');
$class->action->job::dispatch('some property');
I would be glad if you have advice for the solution.
I have a job table, i have a jobs table. i am store class name in "job" field. When I call without a construct the job goes into the queue. When i pass a parameter job dispatch function, job give me a error.
Solution
I resolve problem. I init my class name a variable before. When i call variable statically work for me.
$job = $cartBulkAction->action->job;
$job::dispatch($cartBulkAction->id);
Answered By - pinokyov Answer Checked By - Cary Denson (WPSolving Admin)