CardMain.php 583 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class CardMain extends Model
  6. {
  7. protected $table = 'card_main';
  8. protected $primaryKey = 'card_main_id';
  9. protected $dateFormat = 'U';
  10. const CREATED_AT = 'card_main_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. return $this->hasOne(SysCategory::class,'category_id','join_card_main_category_id')->select('category_id','category_name');
  18. }
  19. }