inRandomOrder()->get(); foreach ($seeds as $seed) { dispatch(new scrapeProperties($seed)); } /* foreach($seeds::all() as $seed){ $response = Http::get($seed->uri); $json = $response->json(); foreach($json['offers'] as $offer){ $property = Property::firstWhere('property_platform_id', $offer['id']); if($property && $property->check_data === implode(',', $offer['geoLocation'])){ $property->last_found = now(); $property->save(); }else if($property && $property->check_data !== implode(',', $offer['geoLocation'])){ dump('error'); }else{ Property::create([ 'property_platform_id' => $offer['id'], 'seed_id' => $seed->id, 'check_data' => implode(',', $offer['geoLocation']), 'last_found' => now() ]); } } } */ } public static function getOccupancies(){ // get all properties from model in random order. $properties = Property::select('id','property_platform_id')->inRandomOrder()->get(); foreach($properties as $property){ dump($property->id); /* $response = Http::get('https://www.e-domizil.ch/api/v2/calendar/'.$property->property_platform_id, [ 'year' => date("Y") ]); $data = $response->json(); Occupancy::create([ 'property_id' => $property->id, 'occupancy' => json_encode($data['content']['days']), 'header' => json_encode($response->headers()) ]); */ } } }