Contract.php 807 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. 'sign_party' => 'array',
  24. ];
  25. /**
  26. * 为数组 / JSON 序列化准备日期。
  27. *
  28. * @param \DateTimeInterface $date
  29. * @return string
  30. */
  31. protected function serializeDate(DateTimeInterface $date)
  32. {
  33. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  34. }
  35. }