public function getbannerDataById($id) { return $this->db->table('m_banner') ->where('page_id', $id) ->where('status', 1) ->get() ->getResultArray(); } public function getmainData() { return $this->db->table('m_home')->get()->getResultArray(); } public function updatemain($id, $data) { return $this->db->table('m_home') ->where('id', $id) ->update($data); } // <-------banner --------> public function getpage() { return $this->db->table('m_page')->get()->getResultArray(); } public function getbanner_sec($page_id) { return $this->db->table('m_banner') ->where('page_id', $page_id) ->get() ->getResultArray(); } public function getbannerInfo($page_id, $row_id) { return $this->db->table('m_banner') ->where('page_id', $page_id) ->where('id', $row_id) ->get() ->getRowArray(); } public function updatebanner_data($row_id, $page_id, $data) { return $this->db->table('m_banner') ->where('id', $row_id) ->where('page_id', $page_id) ->update($data); } // <-------homepage data/sections --------> public function getpageDataById($id) { return $this->db->table('m_section_content') ->where('section_id', $id) ->where('status', 1) ->get() ->getResultArray(); } public function getSections() { return $this->db->table('m_sections')->get()->getResultArray(); } public function getHomePageData_sec($section_id) { return $this->db->table('m_section_content') ->where('section_id', $section_id) ->get() ->getResultArray(); } public function getHomePageDataInfo($section_id, $row_id) { return $this->db->table('m_section_content') ->where('section_id', $section_id) ->where('id', $row_id) ->get() ->getRowArray(); } public function updateHomePage_data($row_id, $section_id, $data) { return $this->db->table('m_section_content') ->where('id', $row_id) ->where('section_id', $section_id) ->update($data); } public function insertSection($data) { return $this->db->table('m_section_content')->insert($data); } public function deleteHomePage($id) { $sql = "DELETE FROM `m_section_content` WHERE `id` = ?"; $this->db->query($sql, [$id]); return ($this->db->affectedRows() > 0); } // <---------------code od conduct----------- > public function getcode_conduct() { return $this->db->table('m_codeof_conduct')->get()->getResultArray(); } public function getCodeofcon_data($coc_id) { return $this->db->table('m_codeof_conduct_content') ->where('section_id', $coc_id) ->get() ->getResultArray(); } public function getCodeofcon_info($coc_id, $row_id) { return $this->db->table('m_codeof_conduct_content') ->where('section_id', $coc_id) ->where('id', $row_id) ->get() ->getRowArray(); } public function updatecode_conduct($row_id, $section_id, $data) { return $this->db->table('m_codeof_conduct_content') ->where('id', $row_id,) ->where('section_id', $section_id) ->update($data); } // <---------------news----------- > public function getnews() { return $this->db->table('m_news_events')->get()->getResultArray(); } public function getactivenews() { return $this->db->table('m_news_events') ->where('status', 1) ->orderBy('id', 'DESC') // or use 'created_at' if that’s your datetime column ->get() ->getResultArray(); } public function getactivenews_sidebar() { return $this->db->table('m_news_events') ->where('status', 1) ->orderBy('id', 'DESC') // or use 'created_at' if that’s your datetime column ->limit(5) // only 6 rows ->get() ->getResultArray(); } public function getnewseventById($news_id) { return $this->db->table('m_news_events') ->select('id') ->where('id', $news_id) ->get() ->getRowArray(); } public function getnewseventDataById($news_id) { return $this->db->table('m_news_events') ->where('id', $news_id) ->where('status', 1) ->get() ->getResultArray(); } public function updatenews($news_id, $data) { return $this->db->table('m_news_events') ->where('id', $news_id) ->update($data); } public function insertnews($data) { return $this->db->table('m_news_events')->insert($data); } public function deletenews($news_id) { $sql = "DELETE FROM `m_news_events` WHERE `id` = ?"; $this->db->query($sql, [$news_id]); return ($this->db->affectedRows() > 0); } // <--------courses--------->>>> public function getactive_courses() { return $this->db->table('m_courses') ->where('status', 1) ->get() ->getResultArray(); } public function getCourseNameById($course_id) { return $this->db->table('m_courses') ->select('course') ->where('id', $course_id) ->get() ->getRowArray(); } public function getcourses() { return $this->db->table('m_courses')->get()->getResultArray(); } public function updatecourses($courses_id, $data) { return $this->db->table('m_courses') ->where('id', $courses_id) ->update($data); } public function insertcourses($data) { return $this->db->table('m_courses')->insert($data); } public function deletecourses($courses_id) { $sql = "DELETE FROM `m_courses` WHERE `id` = ?"; $this->db->query($sql, [$courses_id]); return ($this->db->affectedRows() > 0); } // <--------courses_cont--------->>>> public function getCourseDataById($course_id) { return $this->db->table('m_courses_content') ->where('course_id', $course_id) ->where('status', 1) ->get() ->getResultArray(); } public function getCoursedata($courseId) { return $this->db->table('m_courses_content') ->where('course_id', $courseId) ->get() ->getResultArray(); } public function updatecoursecont_data($row_id, $course_id, $data) { return $this->db->table('m_courses_content') ->where('id', $row_id) ->where('course_id', $course_id) ->update($data); } public function updatecoursecont_datafile($row_id, $course_id, $data) { $builder = $this->db->table('m_courses_content')->where('id', $row_id); if ($course_id !== null) { $builder->where('course_id', $course_id); } return $builder->update($data); } public function getCoursedata_info($course_id, $row_id) { return $this->db->table('m_courses_content') ->where('course_id', $course_id) ->where('id', $row_id) ->get() ->getRowArray(); } public function insertcoursecont($data) { return $this->db->table('m_courses_content')->insert($data); } public function delete_courses_con($id) { $sql = "DELETE FROM `m_courses_content` WHERE `id` = ?"; $this->db->query($sql, [$id]); return ($this->db->affectedRows() > 0); } // <--------gallery--------->>>> public function getgallery() { return $this->db->table('m_gallery')->orderBy('id', 'DESC')->get()->getResultArray(); } public function updategallery($gallery_id, $data) { return $this->db->table('m_gallery') ->where('id', $gallery_id) ->update($data); } public function insertgallery($data) { return $this->db->table('m_gallery')->insert($data); } public function deletegallery($gallery_id) { $sql = "DELETE FROM `m_gallery` WHERE `id` = ?"; $this->db->query($sql, [$gallery_id]); return ($this->db->affectedRows() > 0); } // <---faculity->>> public function getfaculity() { return $this->db->table('m_faculity')->get()->getResultArray(); } public function insertfaculity($data) { return $this->db->table('m_faculity')->insert($data); } public function deletefaculity($fac_id) { $sql = "DELETE FROM `m_faculity` WHERE `id` = ?"; $this->db->query($sql, [$fac_id]); return ($this->db->affectedRows() > 0); } public function updatefaculity($gov_id, $data) { return $this->db->table('m_faculity') ->where('id', $gov_id) ->update($data); } // <--------testimonial--------->>>> public function gettestimonial() { return $this->db->table('m_testimonial')->get()->getResultArray(); } public function inserttestimonial($data) { return $this->db->table('m_testimonial')->insert($data); } public function updatetestimonial($test_id, $data) { return $this->db->table('m_testimonial') ->where('id', $test_id) ->update($data); } public function deletetestimonial($test_id) { $sql = "DELETE FROM `m_testimonial` WHERE `id` = ?"; $this->db->query($sql, [$test_id]); return ($this->db->affectedRows() > 0); } // <--------government body--------->>>> public function getgovern_body() { return $this->db->table('m_governing_body')->get()->getResultArray(); } public function getgovern_body_data() { $designationIds = [101, 102, 109]; return $this->db->table('m_governing_body') ->whereIn('desgnation_id', $designationIds) ->get() ->getResultArray(); } public function updategovern_body($gov_id, $data) { return $this->db->table('m_governing_body') ->where('id', $gov_id) ->update($data); } public function insertgovern_body($data) { return $this->db->table('m_governing_body')->insert($data); } public function deletegovern_body($gov_id) { $sql = "DELETE FROM `m_governing_body` WHERE `id` = ?"; $this->db->query($sql, [$gov_id]); return ($this->db->affectedRows() > 0); } // <--------functions to get data--------> public function getcodeof_conduct_Data() { return $this->db->table('m_codeof_conduct_content') ->where('status', 1) ->get() ->getResultArray(); } public function getgallery_data() { return $this->db->table('m_gallery') ->where('status', 1) ->get() ->getResultArray(); } public function getfeaturedgallery_data() { return $this->db->table('m_gallery') ->where('status', 1) ->where('featured', 1) ->get() ->getResultArray(); } public function getgovb_data() { return $this->db->table('m_governing_body') ->where('status', 1) ->get() ->getResultArray(); } }