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