<?php

namespace App\Http\Controllers\Channel\Book\Transformers;

use Hashids;

class ChapterListTransformer
{
    public function transform($chapter)
    {
        return [
            'bid' => Hashids::decode($chapter->bid),
            'chapter_id' => $chapter->id,
            'chapter_name' => $chapter->name,
            'chapter_sequence' => $chapter->sequence,
            'chapter_is_vip' => $chapter->is_vip,
            'chapter_size' => $chapter->size,
            'prev_cid' => $chapter->prev_cid,
            'content' => $chapter->content,
            'next_cid' => $chapter->next_cid,
            'recent_update_at' => $chapter->recent_update_at,
            'is_recommend' => $chapter->is_recommend,
            'recommend_text' => $chapter->recommend_text,
            'is_need_subscirbe' => $chapter->is_need_subscirbe,
            'dafault_subscribe'=>isset($chapter->dafault_subscribe)?$chapter->dafault_subscribe:0,
            'channel_subscribe'=>isset($chapter->channel_subscribe)?$chapter->channel_subscribe:0,
        ];
    }
}