__('Order_status 0'), '10' => __('Order_status 10'), '20' => __('Order_status 20'), '30' => __('Order_status 30'), '40' => __('Order_status 40')]; } public function getPaytypeList() { return ['1' => __('Paytype 1'), '2' => __('Paytype 2'), '3' => __('Paytype 3'), '4' => __('Paytype 4'), '5' => __('Paytype 5')]; } public function getOrderStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['order_status']) ? $data['order_status'] : ''); $list = $this->getOrderStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getPaytypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['paytype']) ? $data['paytype'] : ''); $list = $this->getPaytypeList(); return isset($list[$value]) ? $list[$value] : ''; } 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 getFinishtimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['finishtime']) ? $data['finishtime'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getCancelTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['cancel_time']) ? $data['cancel_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setPaytimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setFinishtimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setCancelTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function user() { return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function slot() { return $this->belongsTo('Lessonslot', 'slot_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function lesson() { return $this->belongsTo('Lesson', 'lesson_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function coach() { return $this->belongsTo('Coach', 'slot.coach_ids', 'id', [], 'LEFT')->setEagerlyType(0); } public function packageorder() { return $this->belongsTo('Packageorder', 'package_order_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function lessonpackage() { return $this->belongsTo('Lessonpackage', 'packageorder.package_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function trylessonorder() { return $this->belongsTo('Trylessonorder', 'trylesson_order_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function trylesson() { return $this->belongsTo('Trylesson', 'trylessonorder.trylesson_id', 'id', [], 'LEFT')->setEagerlyType(0); } }