Auth.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace common\modules\user\models;
  3. /**
  4. * This is the model class for table "{{%auth}}".
  5. *
  6. * @property int $id
  7. * @property int $user_id
  8. * @property string $source
  9. * @property string $source_id
  10. * @property User $user
  11. */
  12. class Auth extends \yii\db\ActiveRecord
  13. {
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public static function tableName()
  18. {
  19. return '{{%auth}}';
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function rules()
  25. {
  26. return [
  27. [['user_id', 'source', 'source_id'], 'required'],
  28. [['user_id'], 'integer'],
  29. [['source', 'source_id'], 'string', 'max' => 255],
  30. ];
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function attributeLabels()
  36. {
  37. return [
  38. 'id' => 'ID',
  39. 'user_id' => 'User ID',
  40. 'source' => 'Source',
  41. 'source_id' => 'Source ID',
  42. ];
  43. }
  44. public function getUser()
  45. {
  46. return $this->hasOne(User::className(), ['id' => 'user_id']);
  47. }
  48. }