public function getViewData(): array
{
// Fetch the pointeau locations
return [
'pointeauLocations' => $this->getPointeauLocations(),
];
}
public function getPointeauLocations()
{
// Assuming the state refers to the `StartRonde` record
$ronde = $this->getRecord()->ronde;
// Fetch the related Pointeaux and map their locations
$locations = $ronde->pointeaux->map(function ($pointeau) {
return $pointeau->location; // Ensure this returns an array or object with lat and lng
})->toArray(); // Convert to array for easy passing to view
// Log the fetched locations
Log::info('Fetched Pointeau Locations:', $locations);
return $locations; // Return the locations
}
public function getViewData(): array
{
// Fetch the pointeau locations
return [
'pointeauLocations' => $this->getPointeauLocations(),
];
}
public function getPointeauLocations()
{
// Assuming the state refers to the `StartRonde` record
$ronde = $this->getRecord()->ronde;
// Fetch the related Pointeaux and map their locations
$locations = $ronde->pointeaux->map(function ($pointeau) {
return $pointeau->location; // Ensure this returns an array or object with lat and lng
})->toArray(); // Convert to array for easy passing to view
// Log the fetched locations
Log::info('Fetched Pointeau Locations:', $locations);
return $locations; // Return the locations
}