<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/12/1
 * Time: 11:42
 */

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

class OrderTransformer
{
    public function transform($orderItem)
    {
        return [
            'uid' => $orderItem->uid,
            'price' => (float)$orderItem->price,
            'status' => $orderItem->status,
            'trade_no' => $orderItem->trade_no,
            'pay_end_at' => $orderItem->pay_end_at,
            'activity_id' => $orderItem->activity_id,
            'send_order_id' => $orderItem->send_order_id,
            'send_order_name' => $orderItem->send_order_name,
            'activity_name' => (string)$orderItem->name,
            'created_at' => $orderItem->created_at->toDateTimeString()
        ];
    }
}