123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- /**
- *
- *
- * @category xxx
- * @package PSR
- * @subpackage Documentation\API
- * @author xxx <xxx@xxx.com>
- * @license GPL https://xxx.com
- * @link https://xxx.com
- * @ctime: 2020/4/30 16:12
- */
- namespace App\Transformers;
- use App\Models\DepositCard;
- use League\Fractal\TransformerAbstract;
- class DepositCardTransformer extends TransformerAbstract
- {
- public function transform(DepositCard $depositCard)
- {
- return [
- 'id' => $depositCard->id,
- 'name' => $depositCard->name,
- 'price' => $depositCard->price,
- 'is_discount_name' => DepositCard::$discountMaps[$depositCard->is_discount],//($depositCard->is_discount),
- 'is_discount' => $depositCard->is_discount,//($depositCard->is_discount),
- 'effective_days' => $depositCard->effective_days,
- 'discount' => bcdiv($depositCard->discount, 10, 1),
- ];
- }
- }
|