backend/controllers/BranchesController.php
/**
     * Lists all Branches models.
     * @return mixed
     */
Lists all Branches models.
@return mixed
Lists all Branches models . @return mixed
public function actionIndex()
    {
        $searchModel = new BranchesSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        if(Yii::$app->request->post('hasEditable')){
            $branchId = Yii::$app->request->post('editableKey');
            $branch =  Branches::findOne($branchId);
            $out = Json::encode(['output'=>'','message'=>'']);
            $posted = current($_POST['Branches']);
            $post['Branches'] =$posted;
            if($branch->load($post)){
                $branch->save();
                $value = $branch->branch_name;
                return Json::encode(['output'=>$value,'message'=>'']);
            }else{
                return Json::encode(['output'=>'','message'=>'']);
            }
        }
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionIndex ( ) { $ searchModel = new BranchesSearch ( ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> queryParams ) ; if ( Yii :: $ app -> request -> post ( 'hasEditable' ) ) { $ branchId = Yii :: $ app -> request -> post ( 'editableKey' ) ; $ branch = Branches :: findOne ( $ branchId ) ; $ out = Json :: encode ( [ 'output' => '' , 'message' => '' ] ) ; $ posted = current ( $ _POST [ 'Branches' ] ) ; $ post [ 'Branches' ] = $ posted ; if ( $ branch -> load ( $ post ) ) { $ branch -> save ( ) ; $ value = $ branch -> branch_name ; return Json :: encode ( [ 'output' => $ value , 'message' => '' ] ) ; } else { return Json :: encode ( [ 'output' => '' , 'message' => '' ] ) ; } } return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; }
Lists all Branches models.
Lists all Branches models .