12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Repositories\Transformers\Area;
- use App\Repositories\Transformers\BaseTransformer;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Area\Point;
- /**
- * Class PointTransformer.
- *
- * @package namespace App\Repositories\Transformers\Area;
- */
- class PointTransformer extends BaseTransformer
- {
- /**
- * Transform the Point entity.
- *
- * @param \App\Repositories\Models\Area\Point $model
- *
- * @return array
- */
- public function lists($model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'cover' => $model->cover,
- 'type' => $model->type,
- 'project' => $model->project,
- 'parent_id' => $model->parent_id,
- 'area' => $model->area,
- 'status' => $model->status,
- /* place your other model properties here */
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- public function detail($model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'cover' => $model->cover,
- 'type' => $model->type,
- 'project_id' => $model->project_id,
- 'area_id' => $model->area_id,
- 'parent_id' => $model->parent_id,
- 'status' => $model->status,
- 'body' => $model->body,
- /* place your other model properties here */
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|