WalletLogTransformer.php 751 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. *
  4. *
  5. * @category xxx
  6. * @package PSR
  7. * @subpackage Documentation\API
  8. * @author xxx <xxx@xxx.com>
  9. * @license GPL https://xxx.com
  10. * @link https://xxx.com
  11. * @ctime: 2020/3/23 9:24
  12. */
  13. namespace App\Transformers;
  14. use App\Models\WalletLog;
  15. use League\Fractal\TransformerAbstract;
  16. class WalletLogTransformer extends TransformerAbstract
  17. {
  18. public function transform(WalletLog $walletLog)
  19. {
  20. return [
  21. 'id' => $walletLog->id,
  22. 'name' => $walletLog->name,
  23. 'operate_type' => WalletLog::$operateTypeMaps[$walletLog->operate_type],
  24. 'money' => $walletLog->money,
  25. 'created_at' => $walletLog->created_at->format('Y-m-d H:i:s'),
  26. ];
  27. }
  28. }