Ejemplo n.º 1
0
 /**
  * @param $deviceList
  * @param Cluster $cluster
  * @param bool $associateDevices
  * @return mixed
  * @throws \App\Exceptions\SoapException
  */
 public static function generateEraserList($deviceList, Cluster $cluster, $associateDevices = true)
 {
     $macList = array_column($deviceList, 'DeviceName');
     $axl = new AxlSoap($cluster);
     if ($associateDevices) {
         $user = $axl->getAxlUser();
         $devices = self::createDeviceArray($user, $macList);
         $axl->updateAxlUser($devices);
     }
     // Get Device IP's
     $sxml = new RisSoap($cluster);
     $risArray = $sxml->createRisPhoneArray($macList);
     $risResults = $sxml->getDeviceIP($risArray);
     $risPortResults = $sxml->processRisResults($risResults, $risArray);
     //Fetch device model from type product
     for ($i = 0; $i < count($risPortResults); $i++) {
         if ($risPortResults[$i]['IsRegistered']) {
             $results = $axl->executeQuery('SELECT name FROM typeproduct WHERE enum = "' . $risPortResults[$i]['Product'] . '"');
             $risPortResults[$i]['Model'] = $results->return->row->name;
         }
     }
     foreach ($deviceList as $row) {
         // Merge the $deviceList and $risPortResults arrays
         $key = array_search($row['DeviceName'], array_column($risPortResults, 'DeviceName'));
         $mergedDeviceArray[] = array_merge($row, $risPortResults[$key]);
     }
     return $mergedDeviceArray;
 }
Ejemplo n.º 2
0
 public function resetPhone(Request $request)
 {
     //Get request input
     $phone = $request->input('name');
     $cluster = $request->input('cluster');
     //Get the cluster for the phone
     $cluster = Cluster::where('ip', $cluster)->first();
     //Create AXL client
     $axl = new AxlSoap($cluster);
     //Attempt a phone reset
     $response = $axl->phoneReset($phone);
     //Return response
     if (isset($response->return)) {
         return json_encode($response->return);
     } else {
         return $response;
     }
 }