<?php

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

class ChannelUserTransformer
{
    public function transform($channelItem)
    {
        return [
            'id' => $channelItem->id,
            'phone' => $channelItem->phone,
            'name' => $channelItem->name,
            'pay_merchant_id' => (float)$channelItem->pay_merchant_id,
            'nickname' => $channelItem->nickname,
            'latest_login_time'   =>  isset($channelItem->latest_login_time) ? date("Y-m-d H:i:s",strtotime($channelItem->latest_login_time)) : "",
            'latest_login_ip' => $channelItem->latest_login_ip,
            'is_enabled' => $channelItem->is_enabled,
            'remark' => $channelItem->remark,
            'channel_user_id'=>$channelItem->id,
            'register_ip' => $channelItem->register_ip,
            'person_in_charge_name'=>$channelItem->person_in_charge_name,
            'create_time'   =>  isset($channelItem->created_at) ? date("Y-m-d H:i:s",strtotime($channelItem->created_at)) : "",
            'distribution_manages_id'=>(float)$channelItem->distribution_manages_id,
            'distribution_manages_account'=>$channelItem->distribution_manages_account,
            'distribution_manages_number'=>$channelItem->distribution_manages_number,
            'distribution_manages_nickname'=>$channelItem->distribution_manages_nickname,
            'company_id'=>(int)$channelItem->company_id,
            'company_name'=>$channelItem->company_name,
            'is_important'=>(int)$channelItem->is_important,
        ];
    }
}