public static function load_data($type) { $dbResult = DB::SELECT('name', 'content')->from('about')->where('type', $type)->execute(); $data = $dbResult->as_array(); $retData['Data']['content'] = $data[0]['content']; return $retData; }
public static function load_admissions_data() { $dbResult = DB::SELECT('name', 'content')->from('admissions_faculty')->where('faculty_id', 2)->execute(); $data = $dbResult->as_array(); foreach ($data as $item) { $retData['Data'][$item['name']] = $item['content']; } return $retData; }
public static function load_highlight() { try { $dbResult = DB::SELECT('ID', 'Title', 'Description')->from('News')->where('Type', 2)->order_by('DateCreate', 'dsc')->limit(1)->execute(); $dbData = $dbResult->as_array(); return $dbData; } catch (\Exception $e) { Log::error($e); // Redirect to 500 server error; return Response::redirect(500); } }
public static function in_pages($page, $section_id) { // Start query with main section ID try { $dbResult = DB::SELECT('ID', 'Title', 'Description')->from('News')->where('Type', $section_id)->order_by('DateCreate', 'dsc')->limit(5)->offset($page * 5)->execute(); $dbData = $dbResult->as_array(); return $dbData; } catch (\Exception $e) { Log::error($e); // Redirect to 500 server error; return Response::redirect(500); } }