pmtpenza

Untitled

Sep 5th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <?php
  2.  
  3. namespace api\models;
  4.  
  5. use Yii;
  6.  
  7. /**
  8. * This is the model class for table "user".
  9. *
  10. * @property int $id
  11. * @property string $username
  12. * @property string $auth_key
  13. * @property string $password_hash
  14. * @property string $password_reset_token
  15. * @property string $email
  16. * @property int $status
  17. * @property int $created_at
  18. * @property int $updated_at
  19. * @property string $verification_token
  20. * @property int $gender
  21. * @property string $phone
  22. * @property int $code
  23. * @property string $birthdate
  24. * @property string $description
  25. * @property string $fio
  26.  
  27. */
  28. class Users extends \yii\db\ActiveRecord
  29. {
  30. public function getUser()
  31. {
  32. return $this->hasMany(Questions::className(), ['user_id'=>'id']);
  33. }
  34. public $file;
  35. const GENDER_MAN = 1;
  36. const GENDER_WOOMAN = 2;
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public static function tableName()
  41. {
  42. return 'user';
  43. }
  44.  
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function rules()
  49. {
  50. return [
  51. [['status', 'gender', 'code'], 'integer'],
  52. [['username'], 'string', 'max' => 255],
  53. [['phone', 'birthdate', 'fio'], 'string', 'max' => 50],
  54. [['description'], 'string', 'max' => 250],
  55. [['file'], 'file'],
  56. ];
  57. }
  58.  
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function attributeLabels()
  63. {
  64. return [
  65. 'id' => 'ID',
  66. 'username' => 'Ник',
  67. 'fio' => 'ФИО',
  68. 'auth_key' => 'Auth Key',
  69. 'password_hash' => 'Password Hash',
  70. 'password_reset_token' => 'Password Reset Token',
  71. 'email' => 'Email',
  72. 'status' => 'Статус',
  73. 'created_at' => 'Дата регистрации',
  74. 'updated_at' => 'Дата редактирования',
  75. 'verification_token' => 'Verification Token',
  76. 'gender' => 'Пол',
  77. 'phone' => 'Телефон',
  78. 'code' => 'Code',
  79. 'birthdate' => 'Дата рождения',
  80. 'description' => 'О себе',
  81. 'file' => 'Аватарка',
  82.  
  83. ];
  84. }
  85. public static function gender()
  86. {
  87. return [
  88. self::GENDER_MAN => 'Мальчик',
  89. self::GENDER_WOOMAN => 'Девочка',
  90. ];
  91. }
  92. }
Add Comment
Please, Sign In to add comment