Как мы помещаем данные в массив в laravel5?
отправить данные в массив: -
НЕСКОЛЬКО КОДЕК, КОТОРЫЙ Я ПОДЕЛАЛ, КАК НИЖЕ:
if(!empty($request))
{
$request->all();
$lan_user_location = $request[0];
$lat_user_location = $request[1];
$vehiclelocation = Vehicle::select('veh_last_location')->get()->toArray();
$location = json_decode($vehiclelocation[849]['veh_last_location']);
$rows[] = $location;
foreach($rows as $key=>$value){
$lan_vehicle=$rows[$key][$key]->long;
$lat_vehicle=$rows[$key][$key]->lati;
}
$location = json_decode($vehiclelocation[851]['veh_last_location']);
$distance = $this->nearesrtdistance(
$lat_user_location,
$lan_user_location,
$lat_vehicle,
$lan_vehicle
);
if($distance<30)
{
$nearlatlong[] = $lat_vehicle;
$nearlatlong[] = $lan_vehicle;
$response = [
'status' => 'success',
'nearlatlong' => $nearlatlong,
'statusCode' => Response::HTTP_OK
];
return response()->json(['response' => $response]);
}
Хотите использовать push lat и long в массиве $ nearlatlong