Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace api\models;
- use Yii;
- /**
- * This is the model class for table "user".
- *
- * @property int $id
- * @property string $username
- * @property string $auth_key
- * @property string $password_hash
- * @property string $password_reset_token
- * @property string $email
- * @property int $status
- * @property int $created_at
- * @property int $updated_at
- * @property string $verification_token
- * @property int $gender
- * @property string $phone
- * @property int $code
- * @property string $birthdate
- * @property string $description
- * @property string $fio
- */
- class Users extends \yii\db\ActiveRecord
- {
- public function getUser()
- {
- return $this->hasMany(Questions::className(), ['user_id'=>'id']);
- }
- public $file;
- const GENDER_MAN = 1;
- const GENDER_WOOMAN = 2;
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'user';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['status', 'gender', 'code'], 'integer'],
- [['username'], 'string', 'max' => 255],
- [['phone', 'birthdate', 'fio'], 'string', 'max' => 50],
- [['description'], 'string', 'max' => 250],
- [['file'], 'file'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'username' => 'Ник',
- 'fio' => 'ФИО',
- 'auth_key' => 'Auth Key',
- 'password_hash' => 'Password Hash',
- 'password_reset_token' => 'Password Reset Token',
- 'email' => 'Email',
- 'status' => 'Статус',
- 'created_at' => 'Дата регистрации',
- 'updated_at' => 'Дата редактирования',
- 'verification_token' => 'Verification Token',
- 'gender' => 'Пол',
- 'phone' => 'Телефон',
- 'code' => 'Code',
- 'birthdate' => 'Дата рождения',
- 'description' => 'О себе',
- 'file' => 'Аватарка',
- ];
- }
- public static function gender()
- {
- return [
- self::GENDER_MAN => 'Мальчик',
- self::GENDER_WOOMAN => 'Девочка',
- ];
- }
- }
Add Comment
Please, Sign In to add comment