<?php

namespace App\Http\Controllers\Xchengxu\User\Transformers;

use Hashids;

class UserShelfBooksTransformer
{
    public function transform($userShelfBook)
    {
        return [
            'id' => $userShelfBook->id,
            'uid' => $userShelfBook->uid,
            'distribution_channel_id' => $userShelfBook->distribution_channel_id,
            //'bid_no_hash' => $userShelfBook->bid,
            'bid' => Hashids::encode($userShelfBook->bid),
            'book_name' => $userShelfBook->book_name,
            'cover' => $userShelfBook->cover,
            'updated_at' => strtotime($userShelfBook->updated_at),
            'first_cid' => $userShelfBook->first_cid,
            'last_cid' => $userShelfBook->last_cid,
        ];
    }
}
