123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019-04-28
- * Time: 19:10
- */
- namespace App\Transformers;
- use App\Shop;
- use League\Fractal\TransformerAbstract;
- use Carbon\Carbon;
- class ShopsTransformer extends TransformerAbstract{
- public function transform(Shop $shop)
- {
- return [
- 'shop_id' => $shop['shop_id'],
- 'shop_name' => $shop['shop_name'],
- 'shop_short_name' => $shop['shop_short_name'],
- 'mobile' => $shop['mobile'],
- 'address' => $shop['address'],
- 'province_id' => $shop['province_id'],
- 'province_name' => $shop['province_name'],
- 'city_id' => $shop['city_id'],
- 'city_name' => $shop['city_name'],
- 'contact_mobile' => $shop['contact_mobile'],
- 'contact_name' => $shop['contact_name'],
- 'shop_desc' => $shop['shop_desc'],
- 'status' => $shop['status'],
- 'logo_img' => $shop['logo_img'],
- 'license_img' => $shop['license_img'],
- 'food_trans_license' => $shop['food_trans_license'],
- 'other_license' => $shop['other_license'],
- 'proportion' => floatval($shop['proportion']),
- 'verify_type' => $shop['verify_type'],
- 'star' => $shop['star'],
- 'created_at' => Carbon::parse($shop['created_at'])->format('Y-m-d H:i:s'),
- 'updated_at' => Carbon::parse($shop['updated_at'])->format('Y-m-d H:i:s'),
- 'shop_account' => !empty($shop->account) ? $shop->account->toArray() : "",
- ];
- }
- }
|