Contract.php 774 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Models;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. /**
  7. * App\Models\Contract
  8. *
  9. * @mixin \Eloquent
  10. */
  11. class Contract extends Model
  12. {
  13. use HasFactory;
  14. protected $guarded = ['id', 'updated_at', 'created_at'];
  15. /**
  16. * The table associated with the model.
  17. *
  18. * @var string
  19. */
  20. protected $table = 'contracts';
  21. protected $casts=[
  22. 'texts' => 'array',
  23. ];
  24. /**
  25. * 为数组 / JSON 序列化准备日期。
  26. *
  27. * @param \DateTimeInterface $date
  28. * @return string
  29. */
  30. protected function serializeDate(DateTimeInterface $date)
  31. {
  32. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  33. }
  34. }