/** * Finds the Precinct model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Precinct the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Precinct::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPrecincts() { return $this->hasMany(Precinct::className(), ['school_id' => 'school_id']); }
/** * @return \yii\db\ActiveQuery */ public function getPrecinct() { return $this->hasOne(Precinct::className(), ['precinct_id' => 'precinct_id']); }
<?php echo $form->field($model, 'profilenumber')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?> <?php echo $form->field($model, 'sex')->dropDownList(['Male' => 'Male', 'Female' => 'Female'], ['prompt' => 'Select your sex', 'style' => 'width: 300px']); ?> <?php $type = Type::find()->all(); $listData = ArrayHelper::map($type, 'type_id', 'type_name'); echo $form->field($model, 'type_id')->dropDownList($listData, ['prompt' => 'Select position', 'style' => 'width: 300px']); ?> <?php $precinct = Precinct::find()->all(); $listData = ArrayHelper::map($precinct, 'precinct_id', 'precinctnumber'); echo $form->field($model, 'precinct_id')->dropDownList($listData, ['prompt' => 'Select your precinct', 'style' => 'width: 300px']); ?> </div> <div class="column3"> <?php echo $form->field($model, 'mothers_maiden_name')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?> <?php echo $form->field($model, 'phonenumber')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?> <?php echo $form->field($model, 'gsis')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?>