Esempio n. 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCategory()
 {
     return $this->hasOne(Category::className(), ['id' => 'id_category']);
 }
Esempio n. 2
0
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'id_user')->dropDownList(ArrayHelper::map(User::find()->asArray()->all(), 'id', 'id'));
?>

    <?php 
echo $form->field($model, 'text')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'id_category')->dropDownList(ArrayHelper::map(Category::find()->asArray()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'active')->checkbox();
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>