/** * Finds the Locality model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Locality the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Locality::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionContact() { $this->layout = 'main_without_container'; $models = Locality::find()->andWhere(['not', ['contact' => '']])->andWhere(['not', ['contact' => null]])->all(); return $this->render('contact', ['models' => $models]); }
echo $form->field($model, 'snils')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'last_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'first_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'patronymic')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'localities')->checkboxList(Locality::getList(), ['class' => 'checkbox-list']); ?> <div class="form-group"> <?php echo Html::submitButton('Сохранить', ['class' => 'btn btn-success']); ?> </div> <?php ActiveForm::end(); ?> </div>
/* @var $model app\modules\appointment\models\Patient */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="patient-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'blocked')->checkbox(); ?> <?php echo $form->field($model, 'locality_id')->dropDownList(Locality::getList()); ?> <?php echo $form->field($model, 'physician_id')->dropDownList(\app\modules\appointment\models\Physician::getList()); ?> <?php echo $form->field($model, 'policy')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'last_name')->textInput(['maxlength' => true]); ?> <?php
/** * @return \yii\db\ActiveQuery */ public function getLocality() { return $this->hasOne(Locality::className(), ['locality_id' => 'locality_id']); }
/** * @return \yii\db\ActiveQuery */ public function getLocalities() { return $this->hasMany(Locality::className(), ['locality_id' => 'locality_id'])->viaTable('physician_locality', ['physician_id' => 'physician_id']); }