AreaTransformer.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace App\Repositories\Transformers\Area;
  3. use App\Repositories\Transformers\BaseTransformer;
  4. use Carbon\Carbon;
  5. use App\Repositories\Models\Area\Area;
  6. /**
  7. * Class AreaTransformer.
  8. *
  9. * @package namespace App\Repositories\Transformers\Area;
  10. */
  11. class AreaTransformer extends BaseTransformer
  12. {
  13. /**
  14. * Transform the Area entity.
  15. *
  16. * @param \App\Repositories\Models\Area\Area $model
  17. *
  18. * @return array
  19. */
  20. public function lists($model)
  21. {
  22. return [
  23. 'id' => (int)$model->id,
  24. 'name' => $model->name,
  25. // 'body' => $model->body,
  26. 'point' => $model->point,
  27. 'line_color' => $model->line_color,
  28. 'area_color' => $model->area_color,
  29. 'fillOpacity' => $model->fillOpacity,
  30. 'type' => $model->type,
  31. 'area' => $model->area,
  32. 'parent_id' => $model->parent_id,
  33. 'project_id' => $model->project_id,
  34. 'status' => $model->status,
  35. 'visible' => true,
  36. // 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  37. 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  38. ];
  39. }
  40. public function detail($model)
  41. {
  42. return [
  43. 'id' => (int)$model->id,
  44. 'name' => $model->name,
  45. 'body' => $model->body,
  46. 'point' => $model->point,
  47. 'line_color' => $model->line_color,
  48. 'area_color' => $model->area_color,
  49. 'fillOpacity' => $model->fillOpacity,
  50. 'visible' => true,
  51. 'type' => $model->type,
  52. 'area' => $model->area,
  53. 'project_id' => $model->project_id,
  54. 'parent_id' => $model->parent_id,
  55. 'status' => $model->status,
  56. 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  57. 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  58. ];
  59. }
  60. }