__('Order_status 0'), '10' => __('Order_status 10'), '20' => __('Order_status 20'), '30' => __('Order_status 30'), '40' => __('Order_status 40')]; } public function getIsFirstList() { return ['0' => __('Is_first 0'), '1' => __('Is_first 1')]; } 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 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 getIsFirstTextAttr($value, $data) { $value = $value ? $value : (isset($data['is_first']) ? $data['is_first'] : ''); $list = $this->getIsFirstList(); 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('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function trylesson() { return $this->belongsTo('Trylesson', 'trylesson_id', 'id', [], 'LEFT')->setEagerlyType(0); } }