__('Type 0'), '1' => __('Type 1')]; } public function getDeliveryStatusList() { return ['0' => __('Delivery_status 0'), '1' => __('Delivery_status 1')]; } public function getReceiptStatusList() { return ['0' => __('Receipt_status 0'), '1' => __('Receipt_status 1')]; } public function getPaytimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['paytime']) ? $data['paytime'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getDeliveryStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['delivery_status']) ? $data['delivery_status'] : ''); $list = $this->getDeliveryStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getReceiptStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['receipt_status']) ? $data['receipt_status'] : ''); $list = $this->getReceiptStatusList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setPaytimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function user() { return $this->belongsTo('app\admin\model\idiom\UserModel', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } }