HelpVideo.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "help_video".
  6. *
  7. * @property integer $id
  8. * @property string $link
  9. * @property integer $cat_id
  10. * @property integer $created_at
  11. *
  12. * @property HelpCategory $cat
  13. */
  14. class HelpVideo extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public static function tableName()
  20. {
  21. return 'help_video';
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['link', 'cat_id'], 'required'],
  30. [['cat_id', 'created_at'], 'integer'],
  31. [['link'], 'string', 'max' => 255],
  32. [['cat_id'], 'exist', 'skipOnError' => true, 'targetClass' => HelpCategory::className(), 'targetAttribute' => ['cat_id' => 'id']],
  33. ];
  34. }
  35. /**
  36. * @inheritdoc
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => Yii::t('app', 'ID'),
  42. 'link' => Yii::t('app', 'Link'),
  43. 'cat_id' => Yii::t('app', 'Cat ID'),
  44. 'created_at' => Yii::t('app', 'Created At'),
  45. ];
  46. }
  47. /**
  48. * @return \yii\db\ActiveQuery
  49. */
  50. public function getCat()
  51. {
  52. return $this->hasOne(HelpCategory::className(), ['id' => 'cat_id']);
  53. }
  54. }