예제 #1
0
 /**
  * Updates an existing TblAssetLoan model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $user = $model->external_user;
     $external = TblExternalUser::find()->where(['external_user' => $user])->one();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->entry_id]);
     } else {
         return $this->render('update', ['model' => $model, 'external' => $external]);
     }
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TblExternalUser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['external_user' => $this->external_user, 'id_number' => $this->id_number, 'status' => $this->status, 'phone_number' => $this->phone_number]);
     $query->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Finds the TblExternalUser model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TblExternalUser the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TblExternalUser::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getExternalUser()
 {
     return $this->hasOne(TblExternalUser::className(), ['external_user' => 'external_user']);
 }