UserShelfBooksTransformer.php 945 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Controllers\QuickApp\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. 'last_chapter' => $userShelfBook->last_chapter,
  20. 'recent_reading_chapter' => $userShelfBook->recent_reading_chapter,
  21. 'recent_cid'=>$userShelfBook->recent_cid,
  22. ];
  23. }
  24. }