<?php

namespace App\Http\Controllers\Channel\Order\Transformers;
use Hashids;
class ChapterOrderTransformer
{
    public function transform($res){
        /*
        return [
            'uid'          		=>  $res->uid,
            //'bid_no_hash'       =>  $res->bid,
            'bid'            	=>  Hashids::encode($res->bid),
            'cid'   		    =>  $res->cid,
            'book_name'         =>  $res->book_name,
            'chapter_name'      =>  $res->chapter_name,
            'fee'               =>  $res->fee,
            'created_at'        =>  date("Y-m-d H:i:s",strtotime($res->created_at)),
        ];
        */
        return [
            'id'          		=>  $res->id,
            'type'            	=>  '消耗',
            'detail'   		    =>  '章节消费',
            'book_name'         =>  $res->book_name,
            'chapter_name'      =>  $res->chapter_name,
            'fee'               =>  $res->fee,
            'created_at'        =>  date("Y-m-d H:i:s",strtotime($res->created_at)),
        ];
    }
}