__('Status -3'), '0' => __('Status 0'), '3' => __('Status 3')]; } public function getStartTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getEndTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getReservationTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['reservation_time']) ? $data['reservation_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getFinishTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['finish_time']) ? $data['finish_time'] : ''); 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 setStartTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setEndTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setReservationTimeAttr($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 order() { return $this->belongsTo('app\admin\model\school\classes\Order', 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function spec() { return $this->belongsTo('app\admin\model\school\classes\lib\Spec', 'classes_lib_spec_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function user() { return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function detail() { return $this->belongsTo('app\admin\model\school\classes\order\Detail', 'classes_order_detail_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function lib() { return $this->belongsTo('app\admin\model\school\classes\Lib', 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0); } }