public function rules(){ return [ [['name','domain','mobile','email','password','description'],'required'], [['name','domain','contact','email'], 'trim'], ['address' , 'safe'], ['email','email'], [['mobile','contact'] ,'number'], ['image', 'image'], ['email','unique','targetClass' => Users::className(), 'targetAttribute' => 'email'] ]; }
public function getUser(){ return $this->hasOne(Users::className(),['id' => 'user'])->viaTable(CompanyUsers::tableName(),['company' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getUser0() { return $this->hasOne(Users::className(), ['id' => 'user']); }
/** * @return \yii\db\ActiveQuery */ public function getUsers() { return $this->hasMany(Users::className(), ['user_role' => 'id']); }