ApiShare.php 1022 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%api_share}}".
  6. *
  7. * @property integer $id
  8. * @property integer $uid
  9. * @property integer $share_uid
  10. * @property integer $c_time
  11. */
  12. class ApiShare extends \yii\db\ActiveRecord
  13. {
  14. public static function tableName()
  15. {
  16. return '{{%api_share}}';
  17. }
  18. /**
  19. * @inheritdoc
  20. */
  21. public function rules()
  22. {
  23. return [
  24. [['uid', 'share_uid'], 'required'],
  25. ];
  26. }
  27. /**
  28. * @inheritdoc
  29. */
  30. public function attributeLabels()
  31. {
  32. return [
  33. 'id' => 'ID',
  34. 'uid' => 'uid',
  35. 'share_uid' => '分享着id',
  36. 'c_time' => 'c_time',
  37. ];
  38. }
  39. public function getUser()
  40. {
  41. return $this->hasOne(User::className(),['id'=>'uid'])->select("username,role");
  42. }
  43. public function getSuser()
  44. {
  45. return $this->hasOne(User::className(),['id'=>'share_uid'])->select("username,role");
  46. }
  47. }