123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Repositories\Transformers\Area;
- use App\Repositories\Transformers\BaseTransformer;
- use Carbon\Carbon;
- use App\Repositories\Models\Area\Area;
- /**
- * Class AreaTransformer.
- *
- * @package namespace App\Repositories\Transformers\Area;
- */
- class AreaTransformer extends BaseTransformer
- {
- /**
- * Transform the Area entity.
- *
- * @param \App\Repositories\Models\Area\Area $model
- *
- * @return array
- */
- public function lists($model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- // 'body' => $model->body,
- 'point' => $model->point,
- 'line_color' => $model->line_color,
- 'area_color' => $model->area_color,
- 'fillOpacity' => $model->fillOpacity,
- 'type' => $model->type,
- 'area' => $model->area,
- 'parent_id' => $model->parent_id,
- 'project_id' => $model->project_id,
- 'status' => $model->status,
- 'visible' => true,
- // 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- public function detail($model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'body' => $model->body,
- 'point' => $model->point,
- 'line_color' => $model->line_color,
- 'area_color' => $model->area_color,
- 'fillOpacity' => $model->fillOpacity,
- 'visible' => true,
- 'type' => $model->type,
- 'area' => $model->area,
- 'project_id' => $model->project_id,
- 'parent_id' => $model->parent_id,
- 'status' => $model->status,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|