public function configuration() { $row = UserWorkspace::where('USER_ID', '=', $this->ID)->select('DATE_FORMAT', 'TIME_FORMAT', 'DECIMAL_MARK')->first(); $formatSetting = []; $formatSetting['DATE_FORMAT'] = $row && $row->DATE_FORMAT ? $row->DATE_FORMAT : DateTimeFormat::$defaultFormat['DATE_FORMAT']; $formatSetting['TIME_FORMAT'] = $row && $row->TIME_FORMAT ? $row->TIME_FORMAT : DateTimeFormat::$defaultFormat['TIME_FORMAT']; $formatSetting['DECIMAL_MARK'] = $row && $row->DECIMAL_MARK ? $row->DECIMAL_MARK : DateTimeFormat::$defaultFormat['DECIMAL_MARK']; return $formatSetting; }
private function getWorkSpaceInfo() { $user_name = ''; if (auth()->user() != null) { $user_name = auth()->user()->username; } $user_workspace = UserWorkspace::getTableName(); $facility = Facility::getTableName(); $lo_area = LoArea::getTableName(); $lo_production_unit = LoProductionUnit::getTableName(); $workspace = DB::table($user_workspace . ' AS a')->join($facility . ' AS b', 'a.W_FACILITY_ID', '=', 'b.ID')->join($lo_area . ' AS c', 'b.AREA_ID', '=', 'c.ID')->join($lo_production_unit . ' AS d', 'c.PRODUCTION_UNIT_ID', '=', 'd.ID')->where(['a.USER_NAME' => $user_name])->select('a.*', DB::raw('DATE_FORMAT(a.W_DATE_BEGIN, "%m/%d/%Y") as DATE_BEGIN'), DB::raw('DATE_FORMAT(a.W_DATE_END, "%m/%d/%Y") as DATE_END'), 'b.AREA_ID', 'c.PRODUCTION_UNIT_ID')->first(); return $workspace; }