MainMember.php 965 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Models\Main;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Model;
  5. class MainMember extends Model
  6. {
  7. protected $connection = 'mysqlTwo';
  8. /**
  9. * The table associated with the model.
  10. *
  11. * @var string
  12. */
  13. protected $table = 'members';
  14. /**
  15. * The primary key associated with the table.
  16. *
  17. * @var string
  18. */
  19. protected $primaryKey = 'id';
  20. /**
  21. * Indicates if the model should be timestamped.
  22. *
  23. * @var bool
  24. */
  25. public $timestamps = true;
  26. /**
  27. * 不能被批量赋值的属性
  28. *
  29. * @var array
  30. */
  31. protected $guarded = [ 'id', 'updated_at', 'created_at'];
  32. /**
  33. * 为数组 / JSON 序列化准备日期。
  34. *
  35. * @param DateTimeInterface $date
  36. * @return string
  37. */
  38. protected function serializeDate(DateTimeInterface $date)
  39. {
  40. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  41. }
  42. }