Beispiel #1
0
 protected function findModelProfile($id)
 {
     if (($model = Profile::find()->where('user_id = :user_id', [':user_id' => $id])->one()) !== null) {
         return $model;
     } else {
         return false;
     }
 }
Beispiel #2
0
 public function getProfile()
 {
     return $this->hasOne(Profile::className(), ['id' => 'user_id']);
 }
Beispiel #3
0
/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>
    <?php 
$name = Profile::getProfile($model->id);
?>
    <?php 
echo $form->field($model, 'name')->textInput(['value' => isset($name->name) ? $name->name : null]);
?>

    <?php 
echo $form->field($model, 'role')->dropDownList(User::$typeUser);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList([User::STATUS_BLOCKED => 'Заблокирован', User::STATUS_ACTIVE => 'Активен', User::STATUS_WAIT => 'Ожидает подтверждения']);
?>


    <div class="form-group">