backend/modules/api/controllers/HostsController.php
/**
    * @return Array with All hosts with LastChecked date
    */
@return Array with All hosts with LastChecked date
@return Array with All hosts with LastChecked date
public function actionProviders(){
        $service = $this->hosts->getService();
        $host = $this->hosts->getHostById(Yii::$app->request->post());
        if($host->status == 'active'){
            $status = "INACTIVE";
            if(null!=$this->hosts->updateContentProviderByApiCall($host->content_provider_id,$service->api_url,$status)){
                $host->status ='inactive';
                $host->save();
                $hosts = $this->hosts->getAllHostsApi();
                return ['status'=>'success', 'resource' => $hosts];
            }
        }else{
            $status = "ACTIVE";
            if(null!=$this->hosts->updateContentProviderByApiCall($host->content_provider_id,$service->api_url,$status)){
                $host->status = 'active';
                $host->save();
                $hosts = $this->hosts->getAllHostsApi();
                return ['status'=>'success', 'resource' => $hosts];
            }
        }
    }
public function actionProviders ( ) { $ service = $ this -> hosts -> getService ( ) ; $ host = $ this -> hosts -> getHostById ( Yii :: $ app -> request -> post ( ) ) ; if ( $ host -> status == 'active' ) { $ status = " INACTIVE " ; if ( null != $ this -> hosts -> updateContentProviderByApiCall ( $ host -> content_provider_id , $ service -> api_url , $ status ) ) { $ host -> status = 'inactive' ; $ host -> save ( ) ; $ hosts = $ this -> hosts -> getAllHostsApi ( ) ; return [ 'status' => 'success' , 'resource' => $ hosts ] ; } } else { $ status = " ACTIVE " ; if ( null != $ this -> hosts -> updateContentProviderByApiCall ( $ host -> content_provider_id , $ service -> api_url , $ status ) ) { $ host -> status = 'active' ; $ host -> save ( ) ; $ hosts = $ this -> hosts -> getAllHostsApi ( ) ; return [ 'status' => 'success' , 'resource' => $ hosts ] ; } } }
@return Array with All hosts with LastChecked date
@return Array with All hosts with LastChecked date
//get ApiService  //get host By Id