本文整理汇总了PHP中app\models\Users::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::className方法的具体用法?PHP Users::className怎么用?PHP Users::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Users
的用法示例。
在下文中一共展示了Users::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new Users model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Users();
$model->setScenario('register');
$post = Yii::$app->request->post();
$formName = basename($model->className());
if ($model->load($post)) {
// Default value
$model->is_super_admin = isset($post[$formName]['is_super_admin']) ? $post[$formName]['is_super_admin'] : 0;
$model->role = $model->is_super_admin ? Identity::ROLE_SUPERADMIN : 30;
$model->fecha_conexion = isset($post[$formName]['fecha_conexion']) ? $post[$formName]['fecha_conexion'] : Yii::$app->fn->GetDate('none');
$model->fecha_modif = isset($post[$formName]['fecha_modif']) ? $post[$formName]['fecha_modif'] : Yii::$app->fn->GetDate('none');
$model->fecha_registro = isset($post[$formName]['fecha_registro']) ? $post[$formName]['fecha_registro'] : Yii::$app->fn->GetDate();
$model->id_estado = isset($post[$formName]['id_estado']) ? $post[$formName]['id_estado'] : 1;
if ($model->validate()) {
$model->setPassword();
$model->generateAuthKey();
if ($model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
}
}
// Load empty/error form
return $this->render('create', ['model' => $model]);
}
示例2: rules
public function rules()
{
/*$rules = parent::rules();
$rules[] = ['captcha','required'];
$rules[] = ['captcha','captcha'];*/
return [[['login', 'email', 'password', 'family', 'name', 'captcha'], 'required'], [['login', 'family', 'name', 'father', 'email', 'phone'], 'filter', 'filter' => 'trim'], ['email', 'email'], ['captcha', 'captcha'], [['login', 'family', 'name'], 'string', 'min' => 3, 'max' => 255], ['password', 'string', 'min' => 6, 'max' => 255], ['login', 'unique', 'targetClass' => Users::className(), 'message' => 'Этот логин уже зарегистрирован'], ['email', 'unique', 'targetClass' => Users::className(), 'message' => 'Эта почта уже зарегистрирована'], ['phone', 'unique', 'targetClass' => Users::className(), 'message' => 'Этот телефон уже зарегистрирован']];
}
示例3: getUsers
public function getUsers()
{
return $this->hasMany(Users::className(), ['id' => 'user_id'])->via('userBindings');
}
示例4: getModified
public function getModified()
{
return $this->hasOne(Users::className(), ['id' => 'modified_by']);
}
示例5: getUser
public function getUser()
{
return $this->hasOne(Users::className(), ["id" => "user_id"]);
}
示例6: rules
public function rules()
{
return [[['name', 'email', 'password'], 'filter', 'filter' => 'trim'], [['name', 'email', 'password'], 'required'], ['name', 'string', 'min' => 2, 'max' => 255], ['password', 'string', 'min' => 6, 'max' => 255], ['name', 'unique', 'targetClass' => Users::className(), 'message' => 'это имя занято'], [['email'], 'email'], ['email', 'unique', 'targetClass' => Users::className(), 'message' => 'Почта зарегистрирована'], ['status', 'default', 'value' => Users::STATUS_ACTIVE, 'on' => 'default'], ['status', 'in', 'range' => [Users::STATUS_NOT_ACTIVE, Users::STATUS_ACTIVE]], ['password', 'required', 'on' => 'create']];
}
示例7: getAuthor
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthor()
{
return $this->hasOne(Users::className(), ['user_id' => 'author_id']);
}
示例8: getUsers
public function getUsers()
{
return $this->hasMany(Users::className(), ['id_user' => 'client', 'manager' => 'id_user']);
}
示例9: getProfile
public function getProfile()
{
return $this->hasOne(Users::className(), ['id' => 'author']);
}
示例10: getUsers
/**
* @return \yii\db\ActiveQuery
*/
public function getUsers()
{
return $this->hasMany(Users::className(), ['UserTypeID' => 'UserTypeID']);
}
示例11: actions
public function actions()
{
return ['ajax-update' => ['class' => UserEditableAction::className(), 'modelClass' => Users::className(), 'forceCreate' => false]];
}
示例12: getUsers
public function getUsers()
{
return $this->hasOne(Users::className(), ['id' => 'user_id'])->viaTable('user_networks', ['id' => 'user_networks_id']);
}
示例13: getUsers
/**
* @return \yii\db\ActiveQuery
*/
public function getUsers()
{
return $this->hasMany(Users::className(), ['id' => 'user_id'])->viaTable('users_roles', ['itemname' => 'name']);
}
示例14: getUsers
public function getUsers()
{
return $this->hasOne(\app\models\Users::className(), ['id' => 'FK_organizer_id']);
}
示例15: getUserssolved
public function getUserssolved()
{
return $this->hasMany(Users::className(), ['task_id', 'user_id'])->via('accepted_requests');
}