I merged 2 arrays with the function ArrayMerge and I get this (dd function Result).
Now i want to ask is it possible to movee( 2=> false) element inside (0=>) element and (3=>) false inside (1=>) element ? If someone know how to do that, please help me !
Content of first array before merging
Controller laravel
//Listing clients from java application
public function DevicesGet(){
$route=file_get_contents("C:\Users\Sijan\Desktop\device27.01.2011\edit_path\edit_file.txt");
try{
$device= new Client();
$answer= $device->request('GET', $route.'devices');
$body = $answer->getBody();
$status = 'true';
$message = 'Data found!';
$final= json_decode($body);
$id_array = array();
foreach ($final as $res) {
// Add each id value in your array
$id_array[]= $res->clientId;
}
$a = array();
foreach($id_array as $my_id) {
$response2 = $client->request('GET', $path. 'devices/deviceAvailability/' . $my_id );
$a[] = json_decode($response2->getBody());
}
$path= array_merge($data, $a);
dd($path);
return view('devices.home', ['clients' => $path, 'status'=> $a]);
// is thrown for 400 level errors
}catch(ClientException $ce){
$status = 'false';
$message = $ce->getMessage();
$data = [];
//In the event of a networking error (connection timeout, DNS errors, etc.)
}catch(RequestException $re){
$status = 'false';
$message = $re->getMessage();
$data = [];
}//If some error occurs
catch(Exception $e){
$this->status = 'false';
$this->message = $e->getMessage();
$data = [];
}
Session::flash('error', 'Iist of devices is blank, because no connection !');
return view('devices.home', ['status'=>$status,'message'=>$message,'clients'=>$data]);
}