Adv.php 572 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class Adv extends Model
  6. {
  7. protected $table = 'adv';
  8. protected $primaryKey = 'adv_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'adv_addtimes';
  11. const UPDATED_AT = null;
  12. public function serializeDate(DateTimeInterface $date)
  13. {
  14. return $date->format('Y-m-d H:i:s');
  15. }
  16. public function category()
  17. {
  18. return $this->hasOne(SysCategory::class,'category_id','join_adv_category_id')
  19. ->select('category_id','category_name');
  20. }
  21. }