Asset.php 568 B

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