MaintainTransformer.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Repositories\Transformers\Lab;
  3. use App\Repositories\Transformers\BaseTransformer;
  4. use Carbon\Carbon;
  5. /**
  6. * Class MaintainTransformer.
  7. *
  8. * @package namespace App\Repositories\Transformers\Lab;
  9. */
  10. class MaintainTransformer extends BaseTransformer
  11. {
  12. /**
  13. * Transform the Maintain entity.
  14. *
  15. * @param \App\Repositories\Models\Lab\Maintain $model
  16. *
  17. * @return array
  18. */
  19. public function lists($model)
  20. {
  21. return [
  22. 'id' => (int)$model->id,
  23. 'day' => $model->day,
  24. 'week' => $model->week,
  25. 'time' => $model->time,
  26. 'week_index' => $model->week_index,
  27. 'room' => $model->room,
  28. 'maintain_admin' => $model->maintain_admin,
  29. 'admin' => $model->admin,
  30. // 'body' => $model->body,
  31. 'status' => $model->status,
  32. 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  33. 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  34. ];
  35. }
  36. public function detail($model)
  37. {
  38. return [
  39. 'id' => (int)$model->id,
  40. 'day' => $model->day,
  41. 'week' => $model->week,
  42. 'time' => $model->time,
  43. 'week_index' => $model->week_index,
  44. 'maintain_admin' => $model->maintain_admin,
  45. 'room' => $model->room,
  46. 'admin' => $model->admin,
  47. 'body' => $model->body,
  48. 'status' => $model->status,
  49. 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  50. 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  51. ];
  52. }
  53. }