BillTransformer.php 753 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Controllers\Channel\Finance\Transformers;
  3. /**
  4. * Created by PhpStorm.
  5. * User: tandunzhao
  6. * Date: 2017/11/17
  7. * Time: 下午4:26
  8. */
  9. class BillTransformer
  10. {
  11. public function transform($bill){
  12. return [
  13. // 'channel_id' => $bill->distribution_channel_id,
  14. // 'channel_name' => $bill->distribution_channel_name,
  15. 'date' => date('Y-m-d',strtotime($bill->date)),
  16. 'recharge_amount' => (float)($bill->recharge_amount),
  17. 'settlement_price' => (float)($bill->settlement_price),
  18. 'tallage' => (float)(isset($bill->tallage) ? ($bill->tallage) : 0),
  19. 'rate' => (100 * (float)($bill->rate))."%",
  20. ];
  21. }
  22. }