123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Mead
- * Date: 2019/8/5
- * Time: 2:44 PM
- */
- namespace App\Transformers;
- use App\Models\Area;
- use League\Fractal\TransformerAbstract;
- class AreaTransformer extends TransformerAbstract
- {
- protected $availableIncludes = ['setting'];
- public function transform(Area $area)
- {
- return [
- 'id' => $area->id,
- 'name' => $area->name,
- 'area_fence' => $area->area_fence,
- 'points' => $area->area_fence,
- 'strokeWidth' => 4,
- 'strokeColor' => '#0000FF',
- 'color' => '#0000FF',
- 'width' => 4 ,
- 'fillColor' => '#0203E020',
- 'zIndex' => 1111,
- 'customer_service_time' => $area->customer_service_time,
- 'customer_service_phone' => $area->customer_service_phone
- ];
- }
- public function includeSetting(Area $area)
- {
- return $this->item($area->setting, new AreaSettingTransformer());
- }
- }
|