|
@@ -27,7 +27,10 @@ class Lessonslot extends Model
|
|
|
protected $append = [
|
|
|
'starttime_text',
|
|
|
'endtime_text',
|
|
|
- 'status_text'
|
|
|
+ 'status_text',
|
|
|
+ 'notice_status_text',
|
|
|
+ 'finishtime_text',
|
|
|
+ 'cancel_time_text'
|
|
|
];
|
|
|
|
|
|
|
|
@@ -37,6 +40,11 @@ class Lessonslot extends Model
|
|
|
return ['0' => __('Status 0'), '20' => __('Status 20'), '30' => __('Status 30')];
|
|
|
}
|
|
|
|
|
|
+ public function getNoticeStatusList()
|
|
|
+ {
|
|
|
+ return ['0' => __('Notice_status 0'), '1' => __('Notice_status 1')];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function getStarttimeTextAttr($value, $data)
|
|
|
{
|
|
@@ -59,6 +67,28 @@ class Lessonslot extends Model
|
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function getNoticeStatusTextAttr($value, $data)
|
|
|
+ {
|
|
|
+ $value = $value ? $value : (isset($data['notice_status']) ? $data['notice_status'] : '');
|
|
|
+ $list = $this->getNoticeStatusList();
|
|
|
+ return isset($list[$value]) ? $list[$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 setStarttimeAttr($value)
|
|
|
{
|
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
@@ -69,10 +99,14 @@ class Lessonslot extends Model
|
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
|
}
|
|
|
|
|
|
+ protected function setFinishtimeAttr($value)
|
|
|
+ {
|
|
|
+ return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
|
+ }
|
|
|
|
|
|
- public function lesson()
|
|
|
+ protected function setCancelTimeAttr($value)
|
|
|
{
|
|
|
- return $this->belongsTo('Lesson', 'lesson_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
|
+ return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -80,4 +114,10 @@ class Lessonslot extends Model
|
|
|
{
|
|
|
return $this->belongsTo('Coach', 'coach_ids', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function lesson()
|
|
|
+ {
|
|
|
+ return $this->belongsTo('Lesson', 'lesson_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
|
+ }
|
|
|
}
|