<?php

namespace App\Http\Controllers\Channel\Finance\Transformers;
/**
 * Created by PhpStorm.
 * User: tandunzhao
 * Date: 2017/11/17
 * Time: 下午4:26
 */

class BillTransformer
{
    public function transform($bill){
        return [
//            'channel_id'       =>  $bill->distribution_channel_id,
//            'channel_name'       =>  $bill->distribution_channel_name,
            'date'       =>  date('Y-m-d',strtotime($bill->date)),
            'recharge_amount'       =>  (float)($bill->recharge_amount),
            'settlement_price'   =>  (float)($bill->settlement_price),
            'tallage'   =>  (float)(isset($bill->tallage) ? ($bill->tallage) : 0),
            'rate'   =>  (100 * (float)($bill->rate))."%",
        ];
    }
}