__('Take'), 'depart' => __('Depart'), 'arrive' => __('Arrive'), 'start' => __('Start'), 'over' => __('Over')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getClockInTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['clock_in_time']) ? $data['clock_in_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setClockInTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function findByOrderAndType($order_id, $type) { return $this->where([ "order_id" => $order_id, "type" => $type, ])->find(); } }