$propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]); }); Route::get('/prop/{id}', function (int $id) { $propertyBase = Api::propertyBase($id); $extractions = Api::propertyExtractions($id); $propertyCapacities = Api::propertyCapacities($id); $data = []; $dates = []; foreach ($extractions as $ext) { $series = []; $dates[] = $ext['created_at']; $extCalendar = json_decode($ext['calendar'], 1); foreach ($extCalendar as $date => $status) { $series[] = [$date, $status]; } $data[] = $series; } return view('property', ['base' => $propertyBase[0], "extractiondates" => json_encode($dates), "calendar" => $data, 'capacities' => $propertyCapacities]); });