UserShelfBooksTransformer.php 752 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Controllers\WapAlipay\User\Transformers;
  3. use Hashids;
  4. class UserShelfBooksTransformer
  5. {
  6. public function transform($userShelfBook)
  7. {
  8. return [
  9. 'id' => $userShelfBook->id,
  10. 'uid' => $userShelfBook->uid,
  11. 'distribution_channel_id' => $userShelfBook->distribution_channel_id,
  12. //'bid_no_hash' => $userShelfBook->bid,
  13. 'bid' => Hashids::encode($userShelfBook->bid),
  14. 'book_name' => $userShelfBook->book_name,
  15. 'cover' => $userShelfBook->cover,
  16. 'updated_at' => strtotime($userShelfBook->updated_at),
  17. 'first_cid' => $userShelfBook->first_cid,
  18. 'last_cid' => $userShelfBook->last_cid,
  19. ];
  20. }
  21. }