lots of progress
This commit is contained in:
@@ -45,18 +45,9 @@ class FetchItemDataCommand extends Command
|
||||
|
||||
private function getBatch(string $type, int $batch, string $job)
|
||||
{
|
||||
return ItemToFetch::has('jobs')
|
||||
->with([
|
||||
// 'jobs' => fn ($jobs) => dd($jobs->first()->remaining_jobs) /*array_search($job, $jobs->first()->remaining_jobs, true)*/,
|
||||
'jobs' => function ($jobs) use ($job) {
|
||||
$remainingJobs = $jobs->first()->remaining_jobs;
|
||||
if (is_string($remainingJobs)) {
|
||||
$remainingJobs = json_decode($jobs->first()->remaining_jobs, true);
|
||||
}
|
||||
return array_search($job, $remainingJobs, true);
|
||||
},
|
||||
|
||||
])
|
||||
return ItemToFetch::whereHas('jobs', function($query) use ($job){
|
||||
return $query->where('jobs', '<>', null)->whereRaw('FIND_IN_SET(?, jobs)', [$job]);
|
||||
})->with(['jobs'])
|
||||
->where('type', $type)
|
||||
->take($batch)
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user