ReferralLink.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace reactlogic\referral\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "referral_link".
  6. *
  7. * @property int $id
  8. * @property string $title
  9. * @property string $source
  10. * @property string|null $link
  11. * @property string|null $link_hash
  12. * @property int $clicks
  13. * @property int $registrations
  14. * @property int|null $owner
  15. */
  16. class ReferralLink extends \yii\db\ActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return 'referral_link';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['title', 'source', 'clicks', 'registrations'], 'required'],
  32. [['link'], 'string'],
  33. [['clicks', 'registrations', 'owner'], 'integer'],
  34. [['title', 'source', 'link_hash'], 'string', 'max' => 191],
  35. [['link_hash'], 'unique'],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => Yii::t('app', 'ID'),
  45. 'title' => Yii::t('app', 'Title'),
  46. 'source' => Yii::t('app', 'Source'),
  47. 'link' => Yii::t('app', 'Link'),
  48. 'link_hash' => Yii::t('app', 'Link Hash'),
  49. 'clicks' => Yii::t('app', 'Clicks'),
  50. 'registrations' => Yii::t('app', 'Registrations'),
  51. 'owner' => Yii::t('app', 'Owner'),
  52. ];
  53. }
  54. /**
  55. * {@inheritdoc}
  56. * @return ReferralLinkQuery the active query used by this AR class.
  57. */
  58. public static function find()
  59. {
  60. return new ReferralLinkQuery(get_called_class());
  61. }
  62. }