where('plat_id', Shop::$PLAT_KTT) ->where('expires_at', '>', time()) ->get(['id', 'plat_id']) ->toArray(); foreach ($shops as $shop) { $client = BusinessFactory::init()->make($shop['plat_id'])->setShopWithId($shop['id']); $client->createGroup($event->groupId); KttQueryGroupStatus::dispatch($event->groupId, $shop['id'])->delay(5); } } }