Beispiel #1
0
 public function actionSave_file_info()
 {
     if (Yii::$app->request->isAjax) {
         $id = $_POST['id'];
         $PageFileRel_model = PageFiles::find()->where(['id' => $id])->one();
         $response = [];
         if (!empty($PageFileRel_model)) {
             $PageFileRel_model->heading = $_POST['heading'];
             $PageFileRel_model->desc = '';
             $PageFileRel_model->is_featured = '';
             $PageFileRel_model->is_yearly = '';
             if ($PageFileRel_model->save()) {
                 $response['files'] = ['msg' => 'Data saved successfully'];
             }
         } else {
             $response['files'] = ['msg' => 'Error saving data.'];
         }
         return json_encode($response);
     }
 }
Beispiel #2
0
 public function getPage_files()
 {
     return $this->hasMany(PageFiles::className(), ['page_id' => 'id']);
 }