Linux lionsclub 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.29 (Ubuntu)
: 161.35.52.75 | : 3.129.58.60
Cant Read [ /etc/named.conf ]
7.4.28
www-data
shells.trxsecurity.org
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
Backdoor Scanner
Backdoor Create
Alfa Webshell
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
lionsclub /
core /
app /
Http /
Controllers /
[ HOME SHELL ]
Name
Size
Permission
Action
APIs
[ DIR ]
drwxr-xr-x
Auth
[ DIR ]
drwxr-xr-x
Dashboard
[ DIR ]
drwxr-xr-x
.DS_Store
10
KB
-rw-r--r--
Controller.php
361
B
-rw-r--r--
HomeController.php
212.39
KB
-rwxr-xr-x
LanguageController.php
525
B
-rw-r--r--
SiteMapController.php
4.28
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : HomeController.php
<?php namespace App\Http\Controllers; use App\Models\Banner; use App\Mail\NotificationEmail; use App\Models\Comment; use App\Models\Contact; use App\Models\Section; use App\Models\Setting; use App\Models\Topic; use App\Models\TopicCategory; use App\Models\TopicField; use App\Models\User; use App\Models\Webmail; use App\Models\WebmasterSection; use App\Models\WebmasterSetting; use Yajra\DataTables\Facades\DataTables; use Illuminate\Http\Request; use Illuminate\Support\Str; use App\Helpers\Helper; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Redirect; use File; ///use DataTables; use Illuminate\Support\Facades\Auth; use App\Models\Member; class HomeController extends Controller { private $uploadPath = "uploads/members/"; public function day1(Request $request) { return view('frontEnd.test.test'); } public function day2(Request $request) { return view('frontEnd.schedules.day2'); } public function day3(Request $request) { return view('frontEnd.schedules.day3'); } public function day4(Request $request) { return view('frontEnd.schedules.day4'); } public function __construct() { // check if script not installed yet. try { $WebmasterSettings = WebmasterSetting::find(1); } catch (\Exception $e) { // check for installation if (!File::exists('core/storage/installed')) { Redirect::to('/install')->send(); } } // check if website is closed $this->close_check(); } public function SEO($seo_url_slug = 0) { return $this->SEOByLang("", $seo_url_slug); } public function SEOByLang($lang = "",$seo_url_slug = 0) { if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale',$lang); } $seo_url_slug = Str::slug($seo_url_slug, '-'); switch ($seo_url_slug) { case "home" : return $this->HomePage(); break; case "about" : $id = 1; $section = 1; return $this->topic($section, $id); break; case "privacy" : $id = 3; $section = 1; return $this->topic($section, $id); break; case "terms" : $id = 4; $section = 1; return $this->topic($section, $id); break; } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $Current_Slug = "seo_url_slug_" . @Helper::currentLanguage()->code; $Default_Slug = "seo_url_slug_" . env('DEFAULT_LANGUAGE'); $Current_Title = "title_" . @Helper::currentLanguage()->code; $Default_Title = "title_" . env('DEFAULT_LANGUAGE'); $WebmasterSection1 = WebmasterSection::where($Current_Slug, $seo_url_slug)->orwhere($Default_Slug, $seo_url_slug)->first(); if (!empty($WebmasterSection1)) { // MAIN SITE SECTION $section = $WebmasterSection1->id; return $this->topics($section, 0); } else { $WebmasterSection2 = WebmasterSection::where($Current_Title, $seo_url_slug)->orwhere($Default_Title, $seo_url_slug)->first(); if (empty($WebmasterSection2)) { $AllWebmasterSections = WebmasterSection::where('status', 1)->get(); foreach ($AllWebmasterSections as $TWebmasterSection) { if ($TWebmasterSection->$Current_Title != "") { $TTitle = $TWebmasterSection->$Current_Title; } else { $TTitle = $TWebmasterSection->$Default_Title; } $TTitle_slug = Str::slug($TTitle, '-'); if ($TTitle_slug == $seo_url_slug) { $WebmasterSection2 = $TWebmasterSection; break; } } } if (!empty($WebmasterSection2)) { // MAIN SITE SECTION $section = $WebmasterSection2->id; return $this->topics($section, 0); } else { $Section = Section::where('status', 1)->where($Current_Slug, $seo_url_slug)->orwhere($Default_Slug, $seo_url_slug)->first(); if (empty($Section)) { $AllSection = Section::where('status', 1)->get(); foreach ($AllSection as $TSection) { if ($TSection->$Current_Title != "") { $TTitle = $TSection->$Current_Title; } else { $TTitle = $TSection->$Default_Title; } $TTitle_slug = Str::slug($TTitle, '-'); if ($TTitle_slug == $seo_url_slug) { $Section = $TSection; break; } } } if (!empty($Section)) { // SITE Category $section = $Section->webmaster_id; $cat = $Section->id; return $this->topics($section, $cat); } else { $Topic = Topic::where('status', 1)->where($Current_Slug, $seo_url_slug)->orwhere($Default_Slug, $seo_url_slug)->first(); if (empty($Topic)) { $AllTopics = Topic::where('status', 1)->get(); foreach ($AllTopics as $TTopic) { if ($TTopic->$Current_Title != "") { $TTitle = $TTopic->$Current_Title; } else { $TTitle = $TTopic->$Default_Title; } $TTitle_slug = Str::slug($TTitle, '-'); if ($TTitle_slug == $seo_url_slug) { $Topic = $TTopic; break; } } } if (!empty($Topic)) { // SITE Topic $section_id = $Topic->webmaster_id; $WebmasterSection = WebmasterSection::find($section_id); $section = $WebmasterSection->id; $id = $Topic->id; return $this->topic($section, $id); } else { // Not found return redirect()->route("HomePage"); } } } } } public function HomePage() { return $this->HomePageByLang(""); } public function HomePageByLang($lang = "") { if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); // General for all pages $WebsiteSettings = Setting::find(1); // Home topics $HomeTopics = Topic::where([['status', 1], ['webmaster_id', $WebmasterSettings->home_content1_section_id], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['status', 1], ['webmaster_id', $WebmasterSettings->home_content1_section_id], ['expire_date', null]])->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->limit(12)->get(); // Home photos $HomePhotos = Topic::where([['status', 1], ['webmaster_id', $WebmasterSettings->home_content2_section_id], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['status', 1], ['webmaster_id', $WebmasterSettings->home_content2_section_id], ['expire_date', null]])->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->limit(6)->get(); // Home Partners $HomePartners = Topic::where([['status', 1], ['webmaster_id', $WebmasterSettings->home_content3_section_id], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['status', 1], ['webmaster_id', $WebmasterSettings->home_content3_section_id], ['expire_date', null]])->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Get Home page slider banners $SliderBanners = Banner::where('section_id', $WebmasterSettings->home_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Home page Test banners $TextBanners = Banner::where('section_id', $WebmasterSettings->home_text_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; $PageTitle = ""; // will show default site Title $PageDescription = $WebsiteSettings->$site_desc_var; $PageKeywords = $WebsiteSettings->$site_keywords_var; $HomePage = []; if ($WebmasterSettings->default_currency_id > 0) { $HomePage = Topic::where("status", 1)->find($WebmasterSettings->default_currency_id); } // $homeSections = app('App\Http\Controllers\LciPagesController')->homeSections(); // dd($homeSections[0]); // $Leaderships = $homeSections[0]; // $leader_ship = $homeSections[1]; // homesections designs data $Leaderships = Section::select('photo')->where('father_id','21')->get(); $title_leadeship = Section::select('title_en')->where('father_id','21')->get(); $contents_leadership = TopicField::select('field_value')->where('topic_id','12')->get(); $leader_ship = TopicField::select('field_value')->where('topic_id','21')->get(); $events = Section::select('photo')->where('father_id','26')->get(); $title_ourevent = Section::select('title_en')->where('father_id','26')->get(); $contents_ourevent = TopicField::select('field_value')->where('topic_id','13')->get(); $services = Section::select('photo')->where('father_id','35')->get(); $title_services = Section::select('title_en')->where('father_id','35')->get(); $Heading_ourimpact = Topic::select('title_en')->where('id','16')->get(); $contents_ourimpact = TopicField::select('field_value')->where('topic_id','16')->get(); $title_ourimpact = Section::select('title_en')->where('father_id','42')->get(); $details_ourimpact = Topic::select('details_en')->where('title_en','Our impact')->get(); // faq $Heading_faq = Topic::select('title_en')->where('id','17')->get(); // contact $title_contact = Topic::select('details_en')->where('title_en','Contact_us')->get(); $contents_contact = TopicField::select('field_value')->where('topic_id','18')->get(); $img_contact = Section::select('photo')->where('title_en','Contact us')->get(); $our_impact = TopicField::select('field_value')->where('topic_id','19')->get(); $line_ourimpact = Section::select('photo')->where('father_id','48')->get(); // faq $line_faq = Section::select('photo')->where('father_id','55')->get(); // new query // $Home = Section::select('photo')->where('title_en','Main content')->get(); $home_arr = Banner::get()->where('section_id','1')->toArray(); $rosehand = []; foreach ($home_arr as $key => $value ){ array_push($rosehand,$value); } // dd($rosehand); // $Leadership_content = Banner::get()->where('section_id','4')->toArray(); $Leaderships_arr = Banner::get()->where('section_id','4')->toArray(); // title_en details_en file_en link_url //---- sample new array ------> // $newArr = []; // foreach ($Leadership_content as $arr){ // array_push($newArr,$arr); // } // dd($newArr); // dd($Leadership_content); // print_r(array_keys($Leadership_content)); // die; $Leadership_contents = []; foreach ($Leaderships_arr as $key => $value ){ array_push($Leadership_contents,$value); } // dd($Leaderships_arr['title_en']); //wrong method // foreach ($Leaderships_arr as $cont){ // dd($cont['title_en']); //corrct method // } $ourevent_title_arr = Banner::get()->where('section_id','1')->toArray(); $ourevent_title = []; foreach ($ourevent_title_arr as $key => $value ){ array_push($ourevent_title,$value); } // dd($ourevent_title ); $ourevent_arr = Banner::get()->where('section_id','5')->toArray(); $ourevent_contents = []; foreach ($ourevent_arr as $key => $value ){ array_push($ourevent_contents,$value); } // dd($ourevent_contents['title_en']); // dd($ourevent_arr[]); // dd($ourevent_contents[1]['title_en']); $ourimpact_arr = Banner::get()->where('section_id','6')->toArray(); $ourimpact_contents = []; foreach ($ourimpact_arr as $key => $value ){ array_push($ourimpact_contents,$value); } $ourimpact_title_arr = Banner::get()->where('section_id','8')->toArray(); $ourimpact_title = []; foreach ($ourimpact_title_arr as $key => $value ){ array_push($ourimpact_title,$value); } // dd($ourimpact_title); // dd($ourimpact_contents); $service_arr = Banner::get()->where('section_id','7')->toArray(); $sevice_contents = []; foreach ($service_arr as $key => $value ){ array_push($sevice_contents,$value); } $faq_arr = Banner::get()->where('section_id','9')->toArray(); $faq_contents = []; foreach ($faq_arr as $key => $value ){ array_push($faq_contents,$value); } $contact_arr = Banner::get()->where('section_id','10')->toArray(); $contact_contents = []; foreach ($contact_arr as $key => $value ){ array_push($contact_contents,$value); } // limit the words // function limit_text($text, $limit) { // if (str_word_count($text, 0) > $limit) { // $words = str_word_count($text, 2); // $pos = array_keys($words); // $text = substr($text, 0, $pos[$limit]) . '...'; // } // return $text; // } // dd($faq_contents); return view("frontEnd.home", compact("WebsiteSettings", "WebmasterSettings", "SliderBanners", "TextBanners", "PageTitle", "PageDescription", "PageKeywords", "PageTitle", "PageDescription", "PageKeywords", "HomePage", "HomeTopics", "HomePhotos", "HomePartners", "LatestNews", "Leaderships", // "title_leadeship", // "contents_leadership", "leader_ship", "events", "title_ourevent", // "contents_ourevent", "services", "title_services", "Heading_ourimpact", // "contents_ourimpact", // "title_ourimpact", "details_ourimpact", "Heading_faq", "title_contact", "contents_contact", "img_contact", "our_impact", "line_ourimpact", "line_faq", // new home section contents "rosehand", "Leadership_contents", "ourevent_title", "ourevent_contents", "sevice_contents", "ourimpact_title", "ourimpact_contents", "faq_contents", "contact_contents" )); } public function topic($section = 0, $id = 0) { // check url slug if (!is_numeric($id)) { return $this->SEOByLang($section, $id); } $lang_dirs = array_filter(glob(App::langPath() . '/*'), 'is_dir'); // check if this like "/ar/blog" if (in_array(App::langPath() . "/$section", $lang_dirs)) { return $this->topicsByLang($section, $id, 0); } else { return $this->topicByLang("", $section, $id); } } public function topicsByLang($lang = "", $section = 0, $cat = 0) { if (!is_numeric($cat)) { return $this->topicsByLang($section, $cat, 0); } if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); // get Webmaster section settings by name $Current_Slug = "seo_url_slug_" . @Helper::currentLanguage()->code; $Default_Slug = "seo_url_slug_" . env('DEFAULT_LANGUAGE'); $WebmasterSection = WebmasterSection::where($Current_Slug, $section)->orwhere($Default_Slug, $section)->first(); if (empty($WebmasterSection)) { // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($section); } if (!empty($WebmasterSection)) { // if private redirect back to home if ($WebmasterSection->type == 4) { return redirect()->route("HomePage"); } // count topics by Category $category_and_topics_count = array(); $AllSections = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('status', 1)->orderby('row_no', 'asc')->get(); if (count($AllSections) > 0) { foreach ($AllSections as $AllSection) { $category_topics = array(); $TopicCategories = TopicCategory::where('section_id', $AllSection->id)->get(); foreach ($TopicCategories as $category) { $category_topics[] = $category->topic_id; } $Topics = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->whereIn('id', $category_topics)->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->get(); $category_and_topics_count[$AllSection->id] = count($Topics); } } // Get current Category Section details $CurrentCategory = Section::find($cat); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); if (!empty($CurrentCategory)) { $category_topics = array(); $TopicCategories = TopicCategory::where('section_id', $cat)->get(); foreach ($TopicCategories as $category) { $category_topics[] = $category->topic_id; } // update visits $CurrentCategory->visits = $CurrentCategory->visits + 1; $CurrentCategory->save(); // Topics by Cat_ID $Topics = Topic::where(function ($q) use ($WebmasterSection) { $q->where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]]); })->whereIn('id', $category_topics)->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->paginate(env('FRONTEND_PAGINATION')); // Get Most Viewed Topics fot this Category $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->whereIn('id', $category_topics)->orderby('visits', 'desc')->limit(3)->get(); } else { // Topics if NO Cat_ID $Topics = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->paginate(env('FRONTEND_PAGINATION')); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); } // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords if (!empty($CurrentCategory)) { $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($CurrentCategory->$seo_title_var != "") { $PageTitle = $CurrentCategory->$seo_title_var; } else { $PageTitle = $CurrentCategory->$tpc_title_var; } if ($CurrentCategory->$seo_description_var != "") { $PageDescription = $CurrentCategory->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($CurrentCategory->$seo_keywords_var != "") { $PageKeywords = $CurrentCategory->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } } else { $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; $title_var = "title_" . @Helper::currentLanguage()->code; $title_var2 = "title_" . env('DEFAULT_LANGUAGE'); if ($WebmasterSection->$title_var != "") { $PageTitle = $WebmasterSection->$title_var; } else { $PageTitle = $WebmasterSection->$title_var2; } $PageDescription = $WebsiteSettings->$site_desc_var; $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords // Send all to the view $view = "topics"; if ($WebmasterSection->type == 5) { $view = "table"; } $statics = []; foreach ($WebmasterSection->customFields as $customField) { if ($customField->in_statics && ($customField->type == 6 || $customField->type == 7)) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; $statics_row = []; foreach ($cf_details_lines as $cf_details_line) { if ($customField->type == 6) { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", $line_num); } else { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", 'like', '%' . $line_num . '%'); } $Topics_count = Topic::where('webmaster_id', '=', $WebmasterSection->id)->wherein('id', $tids)->count(); $statics_row[$line_num] = $Topics_count; $line_num++; } $statics[$customField->id] = $statics_row; } } return view("frontEnd." . $view, compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "SideBanners", "WebmasterSection", "Categories", "Topics", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "category_and_topics_count", "statics")); } else { return $this->SEOByLang($lang, $section); } } public function topicByLang($lang = "", $section = 0, $id = 0) { if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); // check for pages called by name not id switch ($section) { case "about" : $id = 1; $section = 1; break; case "privacy" : $id = 3; $section = 1; break; case "terms" : $id = 4; $section = 1; break; } // get Webmaster section settings by name $Current_Slug = "seo_url_slug_" . @Helper::currentLanguage()->code; $Default_Slug = "seo_url_slug_" . env('DEFAULT_LANGUAGE'); $WebmasterSection = WebmasterSection::where($Current_Slug, $section)->orwhere($Default_Slug, $section)->first(); if (empty($WebmasterSection)) { // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($section); } if (!empty($WebmasterSection)) { // if private redirect back to home if ($WebmasterSection->type == 4) { return redirect()->route("HomePage"); } // count topics by Category $category_and_topics_count = array(); $AllSections = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('status', 1)->orderby('row_no', 'asc')->get(); if (count($AllSections) > 0) { foreach ($AllSections as $AllSection) { $category_topics = array(); $TopicCategories = TopicCategory::where('section_id', $AllSection->id)->get(); foreach ($TopicCategories as $category) { $category_topics[] = $category->topic_id; } $Topics = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->whereIn('id', $category_topics)->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->get(); $category_and_topics_count[$AllSection->id] = count($Topics); } } $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // Get current Category Section details $CurrentCategory = array(); $TopicCategory = TopicCategory::where('topic_id', $Topic->id)->first(); if (!empty($TopicCategory)) { $CurrentCategory = Section::find($TopicCategory->section_id); } // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('status', 1)->where('father_id', '=', '0')->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords return view("frontEnd.topic", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "category_and_topics_count")); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } } public function topics($section = 0, $cat = 0) { $lang_dirs = array_filter(glob(App::langPath() . '/*'), 'is_dir'); // check if this like "/ar/blog" if (in_array(App::langPath() . "/$section", $lang_dirs)) { return $this->topicsByLang($section, $cat, 0); } else { return $this->topicsByLang("", $section, $cat); } } public function userTopics($id) { return $this->userTopicsByLang("", $id); } public function userTopicsByLang($lang = "", $id) { if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); // get User Details $User = User::find($id); if (!empty($User)) { // count topics by Category $category_and_topics_count = array(); $AllSections = Section::where('status', 1)->orderby('row_no', 'asc')->get(); if (!empty($AllSections)) { foreach ($AllSections as $AllSection) { $category_topics = array(); $TopicCategories = TopicCategory::where('section_id', $AllSection->id)->get(); foreach ($TopicCategories as $category) { $category_topics[] = $category->topic_id; } $Topics = Topic::where([['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['status', 1], ['expire_date', null]])->whereIn('id', $category_topics)->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->get(); $category_and_topics_count[$AllSection->id] = count($Topics); } } // Get current Category Section details $CurrentCategory = "none"; $WebmasterSection = "none"; // Get a list of all Category ( for side bar ) $Categories = Section::where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Topics if NO Cat_ID $Topics = Topic::where([['created_by', $User->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['created_by', $User->id], ['status', 1], ['expire_date', null]])->orderby('row_no', 'asc')->paginate(env('FRONTEND_PAGINATION')); // Get Most Viewed $TopicsMostViewed = Topic::where([['created_by', $User->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['created_by', $User->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; $PageTitle = $User->name; $PageDescription = $WebsiteSettings->$site_desc_var; $PageKeywords = $WebsiteSettings->$site_keywords_var; // .. end of .. Page Title, Description, Keywords // Send all to the view return view("frontEnd.topics", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "User", "SideBanners", "WebmasterSection", "Categories", "Topics", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "category_and_topics_count")); } else { // If no section name/ID go back to home return redirect()->action('HomeController@HomePage'); } } public function searchTopics(Request $request) { // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $search_word = $request->search_word; if ($search_word != "") { // count topics by Category $category_and_topics_count = array(); $AllSections = Section::where('status', 1)->orderby('row_no', 'asc')->get(); if (!empty($AllSections)) { foreach ($AllSections as $AllSection) { $category_topics = array(); $TopicCategories = TopicCategory::where('section_id', $AllSection->id)->get(); foreach ($TopicCategories as $category) { $category_topics[] = $category->topic_id; } $Topics = Topic::where([['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orWhere([['status', 1], ['expire_date', null]])->whereIn('id', $category_topics)->orderby('row_no', env("FRONTEND_TOPICS_ORDER", "asc"))->get(); $category_and_topics_count[$AllSection->id] = count($Topics); } } // Get current Category Section details $CurrentCategory = "none"; $WebmasterSection = "none"; // Get a list of all Category ( for side bar ) $Categories = Section::where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Topics if NO Cat_ID $Topics = Topic::where('title_' . Helper::currentLanguage()->code, 'like', '%' . $search_word . '%') ->orwhere('seo_title_' . Helper::currentLanguage()->code, 'like', '%' . $search_word . '%') ->orwhere('details_' . Helper::currentLanguage()->code, 'like', '%' . $search_word . '%') ->orderby('id', 'desc')->paginate(env('FRONTEND_PAGINATION')); // Get Most Viewed $TopicsMostViewed = Topic::where([['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; $PageTitle = $search_word; $PageDescription = $WebsiteSettings->$site_desc_var; $PageKeywords = $WebsiteSettings->$site_keywords_var; // .. end of .. Page Title, Description, Keywords // Send all to the view return view("frontEnd.topics", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "search_word", "SideBanners", "WebmasterSection", "Categories", "Topics", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "category_and_topics_count")); } else { // If no section name/ID go back to home return redirect()->action('HomeController@HomePage'); } } public function ContactPage() { return $this->ContactPageByLang(""); } public function ContactPageByLang($lang = "") { if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords return view("frontEnd.contact", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed")); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } } public function ContactPageSubmit(Request $request) { $this->validate($request, [ 'contact_name' => 'required', 'contact_email' => 'required|email', 'contact_subject' => 'required', 'contact_message' => 'required' ]); if (env('NOCAPTCHA_STATUS', false)) { $this->validate($request, [ 'g-recaptcha-response' => 'required|captcha' ]); } $site_title_var = "site_title_" . @Helper::currentLanguage()->code; $site_email = @Helper::GeneralSiteSettings("site_webmails"); $Webmail = new Webmail; $Webmail->cat_id = 0; $Webmail->group_id = null; $Webmail->title = $request->contact_subject; $Webmail->details = $request->contact_message; $Webmail->date = date("Y-m-d H:i:s"); $Webmail->from_email = $request->contact_email; $Webmail->from_name = $request->contact_name; $Webmail->from_phone = $request->contact_phone; $Webmail->to_email = $site_email; $Webmail->to_name = @Helper::GeneralSiteSettings($site_title_var); $Webmail->status = 0; $Webmail->flag = 0; $Webmail->save(); // SEND Notification Email if (@Helper::GeneralSiteSettings('notify_messages_status')) { try { $recipient = explode(",", str_replace(" ", "", $site_email)); $message_details = __('frontend.name') . ": " . $request->contact_name . "<hr>" . __('frontend.phone') . ": " . $request->contact_phone . "<hr>" . __('frontend.email') . ": " . $request->contact_email . "<hr>" . __('frontend.message') . ":<br>" . nl2br($request->contact_message); Mail::to($recipient)->send(new NotificationEmail( [ "title" => $request->contact_subject, "details" => $message_details, "from_email" => $request->contact_email, "from_name" => $request->contact_name ] )); } catch (\Exception $e) { } } return "OK"; } public function subscribeSubmit(Request $request) { $this->validate($request, [ 'subscribe_name' => 'required', 'subscribe_email' => 'required|email' ]); // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $Contacts = Contact::where('email', $request->subscribe_email)->get(); if (count($Contacts) > 0) { return __('frontend.subscribeToOurNewsletterError'); } else { $subscribe_names = explode(' ', $request->subscribe_name, 2); $Contact = new Contact; $Contact->group_id = $WebmasterSettings->newsletter_contacts_group; $Contact->first_name = @$subscribe_names[0]; $Contact->last_name = @$subscribe_names[1]; $Contact->email = $request->subscribe_email; $Contact->status = 1; $Contact->save(); return "OK"; } } public function commentSubmit(Request $request) { $this->validate($request, [ 'comment_name' => 'required', 'comment_message' => 'required', 'topic_id' => 'required', 'comment_email' => 'required|email' ]); if (env('NOCAPTCHA_STATUS', false)) { $this->validate($request, [ 'g-recaptcha-response' => 'required|captcha' ]); } // Topic details $Topic = Topic::where('status', 1)->find($request->topic_id); if (!empty($Topic)) { $next_nor_no = Comment::where('topic_id', '=', $request->topic_id)->max('row_no'); if ($next_nor_no < 1) { $next_nor_no = 1; } else { $next_nor_no++; } $Comment = new Comment; $Comment->row_no = $next_nor_no; $Comment->name = $request->comment_name; $Comment->email = $request->comment_email; $Comment->comment = $request->comment_message; $Comment->topic_id = $request->topic_id;; $Comment->date = date("Y-m-d H:i:s"); $Comment->status = (@Helper::GeneralWebmasterSettings('new_comments_status')) ? 1 : 0; $Comment->save(); $site_email = @Helper::GeneralSiteSettings("site_webmails"); $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $tpc_title = $Topic->$tpc_title_var; // SEND Notification Email if (@Helper::GeneralSiteSettings('notify_comments_status')) { try { $recipient = explode(",", str_replace(" ", "", $site_email)); $message_details = __('frontend.name') . ": " . $request->comment_name . "<hr>" . __('frontend.email') . ": " . $request->comment_email . "<hr>" . __('frontend.comment') . ":<br>" . nl2br($request->comment_message); Mail::to($recipient)->send(new NotificationEmail( [ "title" => "Comment: " . $tpc_title, "details" => $message_details, "from_email" => $request->comment_email, "from_name" => $request->comment_name ] )); } catch (\Exception $e) { } } } return "OK"; } public function orderSubmit(Request $request) { $this->validate($request, [ 'order_name' => 'required', 'order_phone' => 'required', 'topic_id' => 'required', 'order_email' => 'required|email' ]); if (env('NOCAPTCHA_STATUS', false)) { $this->validate($request, [ 'g-recaptcha-response' => 'required|captcha' ]); } $site_title_var = "site_title_" . @Helper::currentLanguage()->code; $site_email = @Helper::GeneralSiteSettings("site_webmails"); $Topic = Topic::where('status', 1)->find($request->topic_id); if (!empty($Topic)) { $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $tpc_title = $Topic->$tpc_title_var; $Webmail = new Webmail; $Webmail->cat_id = 0; $Webmail->group_id = 2; $Webmail->contact_id = null; $Webmail->father_id = null; $Webmail->title = "ORDER: " . $Topic->$tpc_title_var; $Webmail->details = $request->order_message; $Webmail->date = date("Y-m-d H:i:s"); $Webmail->from_email = $request->order_email; $Webmail->from_name = $request->order_name; $Webmail->from_phone = $request->order_phone; $Webmail->to_email = $site_email; $Webmail->to_name = @Helper::GeneralSiteSettings($site_title_var); $Webmail->status = 0; $Webmail->flag = 0; $Webmail->save(); // SEND Notification Email if (@Helper::GeneralSiteSettings('notify_orders_status')) { try { $recipient = explode(",", str_replace(" ", "", $site_email)); $message_details = __('frontend.name') . ": " . $request->order_name . "<hr>" . __('frontend.phone') . ": " . $request->order_phone . "<hr>" . __('frontend.email') . ": " . $request->order_email . "<hr>" . __('frontend.notes') . ":<br>" . nl2br($request->order_message); Mail::to($recipient)->send(new NotificationEmail( [ "title" => "Order: " . $tpc_title, "details" => $message_details, "from_email" => $request->order_email, "from_name" => $request->order_name ] )); } catch (\Exception $e) { } } } return "OK"; } public function latest_topics($section_id, $limit = 3) { return Topic::where([['status', 1], ['webmaster_id', $section_id], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['status', 1], ['webmaster_id', $section_id], ['expire_date', null]])->orderby('row_no', 'desc')->limit($limit)->get(); } public function close_check() { // Check the website Status $WebsiteSettings = Setting::find(1); // dd($WebsiteSettings); $site_status = $WebsiteSettings ? $WebsiteSettings->site_status : 1; $site_msg = $WebsiteSettings ? $WebsiteSettings->close_msg : 1; if (!@Auth::check()) { if ($site_status == 0) { // close the website $site_title = $WebsiteSettings->{'site_title_' . Helper::currentLanguage()->code}; $site_desc = $WebsiteSettings->{'site_desc_' . Helper::currentLanguage()->code}; $site_keywords = $WebsiteSettings->{'site_keywords_' . Helper::currentLanguage()->code}; echo "<!DOCTYPE html> <html lang=\"en\"> <head> <meta charset=\"utf-8\"> <title>$site_title</title> <meta name=\"description\" content=\"$site_desc\"/> <meta name=\"keywords\" content=\"$site_keywords\"/> <body> <br> <div style='text-align: center;'> <p>$site_msg</p> </div> </body> </html> "; exit(); } } } // public function ceremony() { return view('frontEnd.resources.ceremony'); } public function maindirectory() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords return view("frontEnd.indialeaders", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed")); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function indiadirectory() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords return view("frontEnd.indiadirectory", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed")); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function getMembersList(Request $request) { if ($request->ajax()) { $data = Member::select('*'); return DataTables::of($data) // ->addIndexColumn() //->make(true); ->addColumn('action', function($row){ $editButton = ''; $deleteButton = ''; if (auth()->user()->permissionsGroup->edit_status) { $editButton = '<a class="btn btn-sm success" href="' . route("membersEdit", ["id" => $row->id]) . '"> <small><i class="material-icons"></i> ' . __('backend.edit') . '</small> </a>'; } if (auth()->user()->permissionsGroup->delete_status) { // $deleteButton = '<button class="btn btn-sm warning" data-toggle="modal" data-target="#m-' . $row->id . '" ui-toggle-class="bounce" ui-target="#animate"> <small><i class="material-icons"></i> ' . __('backend.delete') . '</small> </button>'; $deleteButton = '<button class="btn btn-sm warning delete-btn" data-id="' . $row->id . '"> <small><i class="material-icons"></i> ' . __('backend.delete') . '</small> </button>'; } return $editButton . ' ' . $deleteButton; }) ->rawColumns(['action']) ->addIndexColumn() ->make(true); } } public function index() { // Check Permissions $webmasterId = 75; $data_sections_arr = explode(",", Auth::user()->permissionsGroup->data_sections); if (!in_array($webmasterId, $data_sections_arr)) { return Redirect::to(route('NoPermission'))->send(); } // // General for all pages $GeneralWebmasterSections = WebmasterSection::where('status', '=', '1')->orderby('row_no', 'asc')->get(); // General END //Webmaster Topic Details $WebmasterSection = WebmasterSection::find($webmasterId); if (!empty($WebmasterSection)) { $statics = []; foreach ($WebmasterSection->customFields as $customField) { if ($customField->in_statics && ($customField->type == 6 || $customField->type == 7)) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; $statics_row = []; foreach ($cf_details_lines as $cf_details_line) { if ($customField->type == 6) { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", $line_num); } else { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", 'like', '%' . $line_num . '%'); } $Topics_count = Topic::where('webmaster_id', '=', $WebmasterSection->id)->wherein('id', $tids)->count(); $statics_row[$line_num] = $Topics_count; $line_num++; } $statics[$customField->id] = $statics_row; } } // if($webmasterId == 75){ $members = Member::get(); // // dd($members) // return view("dashboard.topics.directory-list", compact("GeneralWebmasterSections", "WebmasterSection","members", "statics")); return view("dashboard.topics.directory-list", compact("GeneralWebmasterSections", "WebmasterSection", "statics","members")); } else { return redirect()->route('NotFound'); } } public function create() { $webmasterId = 75; $GeneralWebmasterSections = WebmasterSection::where('status', '=', '1')->orderby('row_no', 'asc')->get(); // General END //Webmaster Topic Details $WebmasterSection = WebmasterSection::find($webmasterId); if (!empty($WebmasterSection)) { $statics = []; foreach ($WebmasterSection->customFields as $customField) { if ($customField->in_statics && ($customField->type == 6 || $customField->type == 7)) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; $statics_row = []; foreach ($cf_details_lines as $cf_details_line) { if ($customField->type == 6) { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", $line_num); } else { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", 'like', '%' . $line_num . '%'); } $Topics_count = Topic::where('webmaster_id', '=', $WebmasterSection->id)->wherein('id', $tids)->count(); $statics_row[$line_num] = $Topics_count; $line_num++; } $statics[$customField->id] = $statics_row; } } $members = Member::get(); } return view("dashboard.topics.members_create", compact("GeneralWebmasterSections", "WebmasterSection", "statics","members")); } // public function store(Request $request) // { // $request->validate([ // 'full_name' => 'required|string|max:255', // //'mobile_numbers' => 'required|string|max:255', // //'district' => 'required|string|max:255', // ]); // // dd($request->all()); // $formFileName = "photo"; // $fileFinalName = ""; // if ($request->hasFile('photo')) { // $fileFinalName = time() . rand(1111, // 9999) . '.' . $request->file('photo')->getClientOriginalExtension(); // $path = $this->uploadPath; // // echo "<pre>"; print_r($this->uploadPath); die; // $request->file($formFileName)->move($path, $fileFinalName); // $request->photo = $fileFinalName; // } // // dd($request->all()); // Member::create($request->all()); // return redirect()->route('members')->with('success', 'Member created successfully.'); // } // public function store(Request $request) // { // $request->validate([ // 'full_name' => 'required|string|max:255', // //'mobile_numbers' => 'required|string|max:255', // //'district' => 'required|string|max:255', // ]); // $data = $request->all(); // if ($request->hasFile('photo')) { // $file = $request->file('photo'); // $originalName = $file->getClientOriginalName(); // $path = $this->uploadPath; // $file->move($path, $originalName); // Move the file to the specified path with the original name // $data['photo'] = $originalName; // Save the original name in the data array // } // Member::create($data); // return redirect()->route('members')->with('success', 'Member created successfully.'); // } public function store(Request $request) { $request->validate([ 'full_name' => 'required|string|max:255', 'dropdown_position' => 'nullable|string|max:255', // Making dropdown_position nullable 'custom_position' => 'nullable|string|max:255', // Making custom_position nullable 'category' => 'nullable|string|max:255', // Adding validation for category 'slogan' => 'nullable|string|max:255', // Adding validation for category // 'dob' => 'required|string', // Adding validation for dob //'mobile_numbers' => 'required|string|max:255', //'district' => 'required|string|max:255', ]); $data = $request->all(); // if ($request->filled('custom_position')) { // $data['position'] = $request->input('custom_position'); // } else { // $data['position'] = $request->input('dropdown_position'); // } if ($request->hasFile('photo')) { $file = $request->file('photo'); $originalName = $file->getClientOriginalName(); $timestamp = time(); $path = $this->uploadPath; $newFileName = $timestamp . '_' . $originalName; $file->move($path, $newFileName); // Move the file to the specified path with the new name $data['photo'] = $newFileName; // Save the new name in the data array } $dobInput = $request->input('dob'); if(!empty($dobInput)){ $dobParts = explode('/', $dobInput); if(count( $dobParts)> 1){ $dob['dob'] = $dobParts[2] . '-' . $dobParts[1] . '-' . $dobParts[0]; }else{ $dob['dob'] = $dobInput; } } // Check if the input is only a year // if (preg_match('/^\d{4}$/', $dobInput)) { // $dob = $dobInput; // } else { // // Check if the input is in dd/mm/yyyy format // if (preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $dobInput)) { // // Convert the date to yyyy-mm-dd format for consistency // $dobParts = explode('/', $dobInput); // $dob = $dobParts[2] . '-' . $dobParts[1] . '-' . $dobParts[0]; // } else { // // Handle invalid date format // return back()->withErrors(['dob' => 'Invalid date format']); // } // } // $data['dob'] = $dob; // Save the processed dob in the data array //dd( $dob); Member::create($data); return redirect()->route('members')->with('success', 'Member created successfully.'); } public function list(Request $request) { // dd($request->all()); $title_var = "title_" . @Helper::currentLanguage()->code; $title_var2 = "title_" . env('DEFAULT_LANGUAGE'); $limit = $request->input('length'); $start = $request->input('start'); $dir = $request->input('order.0.dir'); \Cookie::queue("user_documents_page_order", 3, 31104000); //search inputs $folder_id = $request->input('folder_id'); \Session()->put('current_admin_temp_folder_id', $folder_id); $webmasterId = $request->input('webmaster_id'); $q = $request->input('find_q'); $find_date = $request->input('find_date'); if (@Auth::user()->permissionsGroup->view_status) { $Topics = Topic::where('created_by', '=', Auth::user()->id)->where('webmaster_id', '=', $webmasterId); } else { $Topics = Topic::where('webmaster_id', '=', $webmasterId); } if ($q != "") { $tids = TopicField::select("topic_id")->where("field_value", 'like', '%' . $q . '%'); $Topics = $Topics->where(function ($query) use ($q, $tids) { $query->where('title_' . Helper::currentLanguage()->code, 'like', '%' . $q . '%') ->orwhere('seo_title_' . Helper::currentLanguage()->code, 'like', '%' . $q . '%') ->orwhere('details_' . Helper::currentLanguage()->code, 'like', '%' . $q . '%') ->orwherein('id', $tids); }); } if ($find_date != "") { $Topics = $Topics->where("date", Helper::dateForDB($find_date)); } $WebmasterSection = WebmasterSection::find($webmasterId); if (!empty($WebmasterSection)) { if (@Auth::user()->permissionsGroup->edit_status) { $columns = array( 0 => 'check', 1 => 'id', 2 => 'visits', 3 => 'status', ); if ($WebmasterSection->date_status) { $columns = array( 0 => 'check', 1 => 'id', 2 => 'date', 3 => 'visits', 4 => 'status', ); if ($WebmasterSection->expire_date_status) { $columns = array( 0 => 'check', 1 => 'id', 2 => 'date', 3 => 'expire_date', 4 => 'visits', 5 => 'status', ); } } else { if ($WebmasterSection->expire_date_status) { $columns = array( 0 => 'check', 1 => 'id', 2 => 'expire_date', 3 => 'visits', 4 => 'status', ); } } } else { if ($WebmasterSection->date_status) { $columns = array( 0 => 'id', 1 => 'date', 2 => 'visits', 3 => 'status', ); if ($WebmasterSection->expire_date_status) { $columns = array( 0 => 'id', 1 => 'date', 2 => 'expire_date', 3 => 'visits', 4 => 'status', ); } } else { $columns = array( 0 => 'id', 1 => 'visits', 2 => 'status', ); if ($WebmasterSection->expire_date_status) { $columns = array( 0 => 'id', 1 => 'expire_date', 2 => 'visits', 3 => 'status', ); } } } $order = $columns[$request->input('order.0.column')]; if ($order == "") { $order = "id"; } foreach ($WebmasterSection->customFields as $customField) { if ($customField->in_search) { $FField_D = $request->input('customField_' . $customField->id); if ($FField_D != "") { if ($customField->type == 5) { $FField_D = Helper::dateForDB($FField_D,1); } elseif ($customField->type == 4) { $FField_D = Helper::dateForDB($FField_D); } if ($customField->type == 7) { $topics_ids = TopicField::select("topic_id")->where("field_id", $customField->id)->whereRaw("FIND_IN_SET(" . $FField_D . ",REPLACE(`field_value`, ' ', ''))"); } else if ($customField->type == 6) { $topics_ids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", $FField_D); } else { $topics_ids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", 'like', '%' . $FField_D . '%'); } $Topics = $Topics->wherein("id", $topics_ids); } } } } $totalData = $Topics->count(); $totalFiltered = $totalData; //order, paginate $Topics = $Topics->offset($start) ->limit($limit) ->orderBy($order, $dir) ->orderBy("id", "desc") ->get(); $data = array(); if ($totalFiltered > 0) { $total = 0; foreach ($Topics as $Topic) { if ($Topic->$title_var != "") { $title = $Topic->$title_var; } else { $title = $Topic->$title_var2; } // Get Categories list $section = ""; if ($WebmasterSection->sections_status != 0) { foreach ($Topic->categories as $category) { try { if (@$category->section->$title_var != "") { $cat_title = @$category->section->$title_var; } else { $cat_title = @$category->section->$title_var2; } if ($cat_title != "") { $section .= "<span class='label dker b-a text-sm'>" . $cat_title . "</span> "; } } catch (Exception $e) { } } if ($section == "") { $section = "<span style='color: orangered'><i>" . __('backend.topicDeletedSection') . "</i></span>"; } } //comments $comments = ""; if(count($Topic->newComments) >0){ $comments = "<div><a href='".route('topicsComments',[$WebmasterSection->id,$Topic->id])."'><span style='color:red'>".__('backend.comments')." <span class='label rounded label-sm danger'>".count($Topic->newComments)."</span></span></a></div>"; } $photo = ""; if ($Topic->photo_file != "") { $photo = " <div class=\"pull-right\"><img src=\"" . asset('uploads/topics/' . $Topic->photo_file) . "\" style=\"height: 40px\" alt=\"" . $title . "\"></div>"; } $nestedData['check'] = "<div class='row_checker'><label class=\"ui-check m-a-0\"> <input type=\"checkbox\" name=\"ids[]\" value=\"" . $Topic->id . "\"><i class=\"dark-white\"></i> " . Form::hidden('row_ids[]', $Topic->id, array('class' => 'form-control row_no')) . " </label> </div>"; $icon = ""; if ($Topic->icon != "") { $icon = "<i class=\"fa " . $Topic->icon . "\"></i> "; } if ($WebmasterSection->title_status) { $nestedData['id'] = $photo . "<div class='h6'>" . $icon . $title . "</div>" . $section.$comments; } foreach (@$Topic->webmasterSection->customFields as $customField) { // check permission $view_permission_groups = []; if ($customField->view_permission_groups != "") { $view_permission_groups = explode(",", $customField->view_permission_groups); } if (in_array(Auth::user()->permissions_id, $view_permission_groups) || in_array(0, $view_permission_groups) || $customField->view_permission_groups == "") { // have permission & continue if ($customField->in_table) { $cf_saved_val = ""; $cf_saved_val_array = array(); $TField = TopicField::where("topic_id", $Topic->id)->where("field_id", $customField->id)->first(); if (!empty($TField)) { if ($customField->type == 7) { // if multi check $cf_saved_val_array = explode(", ", $TField->field_value); } else { $cf_saved_val = $TField->field_value; } } else { $cf_saved_val = " "; } $cf_data = ""; if (($cf_saved_val != "" || count($cf_saved_val_array) > 0) && ($customField->lang_code == "all" || $customField->lang_code == @Helper::currentLanguage()->code)) { if ($customField->type == 12) { $CF_Vimeo_id = Helper::Get_vimeo_video_id($cf_saved_val); $cf_data = "<a target='_blank' href='https://player.vimeo.com/video/$CF_Vimeo_id?title=0&byline=0'><i class='fa fa-play'></i></a>"; } elseif ($customField->type == 11) { $CF_Youtube_id = Helper::Get_youtube_video_id($cf_saved_val); $cf_data = "<a target='_blank' href='https://www.youtube.com/embed/$CF_Youtube_id'><i class='fa fa-play'></i></a>"; } elseif ($customField->type == 10) { $cf_data = "<a target='_blank' href='" . URL::to('uploads/topics/' . $cf_saved_val) . "'><i class='fa fa-play'></i></a>"; } elseif ($customField->type == 9) { $cf_data = "<a target='_blank' href='" . URL::to('uploads/topics/' . $cf_saved_val) . "'><i class='fa fa-play'></i></a>"; } elseif ($customField->type == 8) { $cf_data = "<a target='_blank' href='" . URL::to('uploads/topics/' . $cf_saved_val) . "'><i class='fa fa-picture-o'></i></a>"; } elseif ($customField->type == 7) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; foreach ($cf_details_lines as $cf_details_line) { if (in_array($line_num, $cf_saved_val_array)) { $cf_data .= "<span class=\"label\">" . $cf_details_line . "</span> "; } $line_num++; } } elseif ($customField->type == 6) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; foreach ($cf_details_lines as $cf_details_line) { if ($line_num == $cf_saved_val) { $cf_data .= "<span class=\"label text-sm\">" . $cf_details_line . "</span> "; } $line_num++; } } elseif ($customField->type == 5) { $cf_data = Helper::dateForDB($cf_saved_val,1); } elseif ($customField->type == 4) { $cf_data = Helper::dateForDB($cf_saved_val); } else { $cf_data = $cf_saved_val; } $nestedData['field_' . $customField->id] = "<div class=\"text-center\">" . $cf_data . "</div>"; $nestedData['class_field_' . $customField->id] = $customField->css_class; } } } } if (@$Topic->webmasterSection->date_status) { $nestedData['date'] = "<div class=\"text-center\">" . Helper::formatDate($Topic->date) . "</div>"; } if (@$Topic->webmasterSection->expire_date_status) { $nestedData['expire_date'] = "<div class=\"text-center\"" . (($Topic->expire_date < date("Y-m-d")) ? "style='color:red'" : "") . ">" . $Topic->expire_date . "</div>"; } if ($WebmasterSection->visits_status) { $nestedData['visits'] = "<div class='text-center'>" . $Topic->visits . "</div>"; } if ($WebmasterSection->case_status) { $nestedData['status'] = "<div class='text-center'> <i class=\"fa " . (($Topic->status == 1) ? "fa-check text-success" : "fa-times text-danger") . " inline\"></i></div>"; } $edit_btn = ""; $edit_btn .= "<a class=\"btn btn-sm info\" href=\"" . ((@$Topic->webmasterSection->type == 4) ? route("topicView", ["webmasterId" => @$Topic->webmasterSection->id, "id" => $Topic->id]) : Helper::topicURL($Topic->id)) . "\" data-toggle=\"tooltip\" data-original-title=\" " . __('backend.viewDetails') . "\"" . ((@$Topic->webmasterSection->type == 4) ? "" : "target='_blank'") . "> <i class=\"material-icons\"></i> </a>"; if (@Auth::user()->permissionsGroup->edit_status) { $edit_btn .= " <a class=\"btn btn-sm success\" href=\"" . route("topicsEdit", ["webmasterId" => @$Topic->webmasterSection->id, "id" => $Topic->id]) . "\" data-toggle=\"tooltip\" data-original-title=\" " . __('backend.edit') . "\"> <i class=\"material-icons\"></i> </a>"; } if (@Auth::user()->permissionsGroup->delete_status) { $edit_btn .= " <button type='button' class=\"btn btn-sm warning\" onclick=\"DeleteTopic('" . $Topic->id . "')\" data-toggle=\"tooltip\" data-original-title=\" " . __('backend.delete') . "\"> <i class=\"material-icons\"></i> </button>"; } $nestedData['options'] = "<div class='text-center'>" . $edit_btn . "</div>"; $data[] = $nestedData; } } $statics = []; $json_data = array( "draw" => intval($request->input('draw')), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data, "statics" => $statics ); echo json_encode($json_data); } // public function subdistrict($id) // { // $subDistrict = SubDistrict::find($id); // // Fetch details specific to the subdistrict // $details = Member::where('sub_district_id', $id)->get(); // return view('frontEnd.subdistrict', compact('subDistrict', 'details')); // } public function subdistrict($name) { $positions = [ 'Past District Governor', ]; // $details = Member::where('district', $name) // ->orderBy('full_name', 'ASC') // ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') // ->get(); // $details = Member::where('district', $name) // ->whereIn('position', $positions) // Add this line to combine the queries // ->orderBy('full_name', 'ASC') // ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') // ->orderBy('sort', 'asc') // Add this line to include the sort order from the second query // ->get(); $details = Member::where('district', $name) ->whereIn('position', $positions) ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') ->orderByRaw('STR_TO_DATE(end_date, "%d/%m/%Y") DESC') ->orderBy('full_name', 'ASC') ->orderBy('sort', 'asc') ->distinct() // Ensure only unique records ->get(); $pastdistrictgov = []; if ($details->count() > 0) { foreach ($details as $detail) { switch ($detail->position) { case 'Past District Governor': // $detail->camelCaseName = ucwords(strtolower($detail->full_name)); $detail->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($detail->full_name)); $pastdistrictgov[] = $detail; break; } } } // Fetch Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); // Fetch Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch Website Settings $WebsiteSettings = Setting::find(1); // Define page metadata $PageTitle = "Subdistrict " . $name . " Details"; $PageDescription = "Detailed information about subdistrict " . $name; $PageKeywords = "subdistrict, information, " . $name; return view('frontEnd.subdistrict', compact('name', 'details', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings', "pastdistrictgov")); } public function districtdirectory($district_id) { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords // $members = Member::where('district', 'like', '%'.$district_id.'%') // ->where('international', 0) // ->whereNull('deleted_at') // ->orderBy('end_date', 'desc') // ->orderBy('start_date', 'desc') // ->get(); // $members = Member::where('district', 'like', '%'.$district_id.'%') // ->where('international', 0) // ->whereNull('deleted_at') // ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') // ->get(); // Fetch subdistricts associated with the district // $subDistricts = SubDistrict::where('district_id', $district_id)->get(); $members = Member::where('district', 'like', '%'.$district_id.'%') ->where('international', 0) ->whereNull('deleted_at') // ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') // ->orderBy('full_name', 'ASC') ->orderBy('district', 'ASC') ->get(); $councilCP = []; $disctrictgov = []; $firstdistrictgov = []; $seconddistrictgov = []; $pastdistrictgov = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'Council Chair Person': $councilCP[] = $member; break; case 'District Governors': $disctrictgov[] = $member; break; case 'First Vice District Governors': $firstdistrictgov[] = $member; break; case 'Second Vice District Governors': $seconddistrictgov[] = $member; break; case 'Past District Governor': $pastdistrictgov[] = $member; break; } } } // Extract unique subdistricts // $subDistricts = $members->pluck('district')->unique(); // $subDistricts = $members->pluck('district')->unique()->sort(); $subDistricts = collect($pastdistrictgov)->pluck('district')->unique()->sort(); return view("frontEnd.districtdirectory", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "councilCP", "disctrictgov", "firstdistrictgov", "seconddistrictgov", "pastdistrictgov", "district_id", "subDistricts" )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function showAllCouncilCP() { // Fetch all council chairpersons $councilCP = Member::where('position', 'Council Chair Person') ->where('international', 0) ->whereNull('deleted_at') ->orderBy('district', 'ASC') ->get(); // Capitalize the first letter of each word in full_name // foreach ($councilCP as $member) { // $member->camelCaseName = ucwords(strtolower($member->full_name)); // } foreach ($councilCP as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); } // Set default values for page metadata $PageTitle = 'All Council Chairpersons of India'; $PageDescription = 'List of all council chairpersons across all districts in India.'; $PageKeywords = 'council chairpersons, India, districts'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; // Set default properties as needed } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed } return view('frontEnd.showAllCouncilCP', compact('councilCP', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function showMemberDetails(Member $member) { $member->camelCaseName = ucwords(strtolower($member->full_name)); $PageTitle = 'Council Chairperson Details'; $PageDescription = 'Details of the council chairperson.'; $PageKeywords = 'council chairperson, details'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; } return view('frontEnd.memberShow', compact('member', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } //correct // public function showAllCouncilCP() // { // // Fetch all council chairpersons from all districts // $councilCP = Member::where('position', 'Council Chair Person') // ->where('international', 0) // ->whereNull('deleted_at') // ->orderBy('district', 'ASC') // ->get(); // // dd($councilCP); // // echo '<pre>'; print_r($councilCP); exit; // // Set default values for page metadata // $PageTitle = 'All Council Chairpersons of India'; // $PageDescription = 'List of all council chairpersons across all districts in India.'; // $PageKeywords = 'council chairpersons, India, districts'; // // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // // Fetch or set default for WebmasterSettings // $WebmasterSettings = WebmasterSetting::first(); // if (!$WebmasterSettings) { // $WebmasterSettings = new \stdClass(); // $WebmasterSettings->author = 'Default Author'; // Set default properties as needed // } // // Fetch or set default for WebsiteSettings // $WebsiteSettings = Setting::first(); // if (!$WebsiteSettings) { // $WebsiteSettings = new \stdClass(); // $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed // } // // Return the view with all necessary data // return view('frontEnd.showAllCouncilCP', compact('councilCP', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); // } // public function showAlldisctrictgov() // { // // Fetch all council chairpersons from all districts // $disctrictgov = Member::where('position', 'District Governors') // ->where('international', 0) // ->whereNull('deleted_at') // ->orderBy('district', 'ASC') // ->get(); // // dd($councilCP); // // echo '<pre>'; print_r($councilCP); exit; // // Set default values for page metadata // $PageTitle = 'All District Governors of India'; // $PageDescription = 'List of all district governors across all districts in India.'; // $PageKeywords = 'district governors, India, districts'; // // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // // Fetch or set default for WebmasterSettings // $WebmasterSettings = WebmasterSetting::first(); // if (!$WebmasterSettings) { // $WebmasterSettings = new \stdClass(); // $WebmasterSettings->author = 'Default Author'; // Set default properties as needed // } // // Fetch or set default for WebsiteSettings // $WebsiteSettings = Setting::first(); // if (!$WebsiteSettings) { // $WebsiteSettings = new \stdClass(); // $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed // } // // Return the view with all necessary data // return view('frontEnd.showAlldisctrictgov', compact('disctrictgov', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); // } // public function showAlldisctrictgov() // { // // Fetch all council chairpersons from all districts // $disctrictgov = Member::where('position', 'District Governors') // ->where('international', 0) // ->whereNull('deleted_at') // ->orderBy('district', 'ASC') // ->get(); // // dd($councilCP); // // echo '<pre>'; print_r($councilCP); exit; // // Set default values for page metadata // $PageTitle = 'All District Governors of India'; // $PageDescription = 'List of all district governors across all districts in India.'; // $PageKeywords = 'district governors, India, districts'; // // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // // Fetch or set default for WebmasterSettings // $WebmasterSettings = WebmasterSetting::first(); // if (!$WebmasterSettings) { // $WebmasterSettings = new \stdClass(); // $WebmasterSettings->author = 'Default Author'; // Set default properties as needed // } // // Fetch or set default for WebsiteSettings // $WebsiteSettings = Setting::first(); // if (!$WebsiteSettings) { // $WebsiteSettings = new \stdClass(); // $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed // } // // Return the view with all necessary data // return view('frontEnd.showAlldisctrictgov', compact('disctrictgov', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); // } public function showAlldisctrictgov() { // Fetch all council chairpersons from all districts $districtGovs = Member::where('position', 'District Governors') ->where('international', 0) ->whereNull('deleted_at') ->orderBy('district', 'ASC') ->get(); // Capitalize the first letter of each word in full_name // foreach ($districtGovs as $member) { // $member->camelCaseName = ucwords(strtolower($member->full_name)); // } foreach ($districtGovs as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); } // Group by district after capitalizing names $districtGovs = $districtGovs->groupBy('district'); // Set default values for page metadata $PageTitle = 'All District Governors of India'; $PageDescription = 'List of all district governors across all districts in India.'; $PageKeywords = 'district governors, India, districts'; // // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; // Set default properties as needed } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed } // Return the view with all necessary data return view('frontEnd.showAlldisctrictgov', compact('districtGovs', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function showDistrictGovDetails(Member $member) { $member->camelCaseName = ucwords(strtolower($member->full_name)); $PageTitle = 'All District Governors of India'; $PageDescription = 'List of all district governors across all districts in India.'; $PageKeywords = 'district governors, India, districts'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; } return view('frontEnd.member', compact('member', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function showAllfirstdistrictgov() { // Fetch all council chairpersons from all districts $firstdistrictgov = Member::where('position', 'First Vice District Governors') ->where('international', 0) ->whereNull('deleted_at') ->orderBy('district', 'ASC') ->get(); // Capitalize the first letter of each word in full_name // foreach ($firstdistrictgov as $member) { // $member->camelCaseName = ucwords(strtolower($member->full_name)); // } // foreach ($firstdistrictgov as $member) { // $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)([a-z])/', function ($matches) { // return strtoupper($matches[1]); // }, strtolower($member->full_name)); // } foreach ($firstdistrictgov as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); } // Group by district after capitalizing names $firstdistrictgov = $firstdistrictgov->groupBy('district'); // dd($councilCP); // echo '<pre>'; print_r($councilCP); exit; // Set default values for page metadata $PageTitle = 'All First Vice District Governors of India'; $PageDescription = 'List of all First Vice district governors across all districts in India.'; $PageKeywords = 'First Vice district governors, India, districts'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; // Set default properties as needed } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed } // Return the view with all necessary data return view('frontEnd.showAllfirstdistrictgov', compact('firstdistrictgov', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function showFirstDistrictGovDetails(Member $member) { $member->camelCaseName = ucwords(strtolower($member->full_name)); $PageTitle = 'All First Vice District Governors of India'; $PageDescription = 'List of all First Vice district governors across all districts in India.'; $PageKeywords = 'First Vice district governors, India, districts'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; } return view('frontEnd.member', compact('member', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function showAllseconddistrictgov() { // Fetch all council chairpersons from all districts $seconddistrictgov = Member::where('position', 'Second Vice District Governors') ->where('international', 0) ->whereNull('deleted_at') ->orderBy('district', 'ASC') ->get(); // Capitalize the first letter of each word in full_name // foreach ($seconddistrictgov as $member) { // $member->camelCaseName = ucwords(strtolower($member->full_name)); // } foreach ($seconddistrictgov as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); } // Group by district after capitalizing names $seconddistrictgov = $seconddistrictgov->groupBy('district'); // dd($councilCP); // echo '<pre>'; print_r($councilCP); exit; // Set default values for page metadata $PageTitle = 'All Second Vice District Governors of India'; $PageDescription = 'List of all Second Vice district governors across all districts in India.'; $PageKeywords = 'Second Vice district governors, India, districts'; // Fetch or set default for LatestNews // $LatestNews = Topic::where('status', 1) // ->orderBy('created_at', 'desc') // ->limit(5) // ->get(); // Fetch or set default for WebmasterSettings $WebmasterSettings = WebmasterSetting::first(); if (!$WebmasterSettings) { $WebmasterSettings = new \stdClass(); $WebmasterSettings->author = 'Default Author'; // Set default properties as needed } // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Fetch or set default for WebsiteSettings $WebsiteSettings = Setting::first(); if (!$WebsiteSettings) { $WebsiteSettings = new \stdClass(); $WebsiteSettings->footer_text = 'Default Footer Text'; // Set default properties as needed } // Return the view with all necessary data return view('frontEnd.showAllseconddistrictgov', compact('seconddistrictgov', 'PageTitle', 'PageDescription', 'PageKeywords', 'WebmasterSettings', 'LatestNews', 'WebsiteSettings')); } public function lci() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International Presidents', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_Presidents = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International Presidents': $Past_International_Presidents[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; } } } return view("frontEnd.lci", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_Presidents", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function exe_officer_isame() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'Excecutive Officers - ISAME' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $exce_offcicer_isame = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); return view("frontEnd.exe_officer_isame", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "exce_offcicer_isame" )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function isame() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International Presidents', 'Past International Presidents from isame', 'International Directors from ISAME', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_Presidents = []; $Past_International_Presidents_from_isame = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International Presidents': $Past_International_Presidents[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; } } } return view("frontEnd.isame", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_Presidents", "Past_International_Presidents_from_isame", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function abode() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International Presidents', 'Past International Presidents from isame', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_Presidents = []; $Past_International_Presidents_from_isame = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International Presidents': $Past_International_Presidents[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; } } } return view("frontEnd.abode", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_Presidents", "Past_International_Presidents_from_isame", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function indiapid() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International President', 'Past International Presidents from isame', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'International Directors from INDIA', 'Past International Directors from INDIA', 'Global Action Team', 'Lions Club International Foundation' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); // $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $members = Member::whereNull('deleted_at') ->whereIn('position', $positions) ->orderByRaw('STR_TO_DATE(start_date, "%d/%m/%Y") DESC') ->orderBy('full_name', 'ASC') ->orderBy('sort', 'ASC') ->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_President = []; $Past_International_Presidents_from_isame = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $International_Directors_from_INDIA = []; $Past_International_Directors_from_INDIA = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International President': $Past_International_President[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'International Directors from INDIA': $International_Directors_from_INDIA[] = $member; break; case 'Past International Directors from INDIA': $Past_International_Directors_from_INDIA[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; } } } return view("frontEnd.indiapid", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_President", "Past_International_Presidents_from_isame", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "International_Directors_from_INDIA", "Past_International_Directors_from_INDIA", "Global_Action_Team", "Lions_Club_International_Foundation", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function indiaid() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International President', 'Past International Presidents from isame', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'International Directors from INDIA', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_President = []; $Past_International_Presidents_from_isame = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $International_Directors_from_INDIA = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International President': $Past_International_President[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'International Directors from INDIA': $International_Directors_from_INDIA[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; } } } return view("frontEnd.indiaid", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_President", "Past_International_Presidents_from_isame", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "International_Directors_from_INDIA", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function gat() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'Global Action Team', 'GAT Constitutional Area Leaders' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions) ->orderBy('full_name', 'ASC') ->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_Presidents = []; $LCIF_Board_of_Trustees_Appointees = []; $Past_International_Presidents_from_isame = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; $GAT_Constitutional_Area_Leaders = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International Presidents': $Past_International_Presidents[] = $member; break; case 'LCIF Board of Trustees Appointees': $LCIF_Board_of_Trustees_Appointees[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; case 'GAT Constitutional Area Leaders': $GAT_Constitutional_Area_Leaders[] = $member; break; } } } return view("frontEnd.gat", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_Presidents", "LCIF_Board_of_Trustees_Appointees", "Past_International_Presidents_from_isame", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", "GAT_Constitutional_Area_Leaders", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function isamecontact() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'ISAME Contact' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions) ->orderBy('full_name', 'ASC') ->get(); $ISAME_Contact = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'ISAME Contact': $ISAME_Contact[] = $member; break; } } } return view("frontEnd.isamecontact", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "ISAME_Contact", )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function lcif() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', 'Lions Council of India Executive', 'Past International Presidents', 'Past International Presidents from isame', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation', 'Constitutional Area Leaders' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; $LCOI_Executive = []; $Past_International_Presidents = []; $Past_International_Presidents_from_isame = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; $Constitutional_Area_Leaders = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; case 'Lions Council of India Executive': $LCOI_Executive[] = $member; break; case 'Past International Presidents': $Past_International_Presidents[] = $member; break; case 'Past International Presidents from isame': $Past_International_Presidents_from_isame[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; case 'Constitutional Area Leaders': $Constitutional_Area_Leaders[] = $member; break; } } } return view("frontEnd.lcif", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", "LCOI_Executive", "Past_International_Presidents", "Past_International_Presidents_from_isame", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", "Constitutional_Area_Leaders" )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function member($member_id) { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $member = Member::find($member_id); return view("frontEnd.member", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "member" )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } public function internationaldirectory() { $lang= ""; if ($lang != "") { // Set Language App::setLocale($lang); \Session::put('locale', $lang); } // General Webmaster Settings $WebmasterSettings = WebmasterSetting::find(1); $id = $WebmasterSettings->contact_page_id; $Topic = Topic::where('status', 1)->find($id); if (!empty($Topic) && ($Topic->expire_date == '' || ($Topic->expire_date != '' && $Topic->expire_date >= date("Y-m-d")))) { // update visits $Topic->visits = $Topic->visits + 1; $Topic->save(); // get Webmaster section settings by ID $WebmasterSection = WebmasterSection::find($Topic->webmaster_id); if (!empty($WebmasterSection)) { // Get current Category Section details $CurrentCategory = Section::find($Topic->section_id); // Get a list of all Category ( for side bar ) $Categories = Section::where('webmaster_id', '=', $WebmasterSection->id)->where('father_id', '=', '0')->where('status', 1)->orderby('webmaster_id', 'asc')->orderby('row_no', 'asc')->get(); // Get Most Viewed $TopicsMostViewed = Topic::where([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', '>=', date("Y-m-d")], ['expire_date', '<>', null]])->orwhere([['webmaster_id', '=', $WebmasterSection->id], ['status', 1], ['expire_date', null]])->orderby('visits', 'desc')->limit(3)->get(); // General for all pages $WebsiteSettings = Setting::find(1); $SideBanners = Banner::where('section_id', $WebmasterSettings->side_banners_section_id)->where('status', 1)->orderby('row_no', 'asc')->get(); // Get Latest News $LatestNews = $this->latest_topics($WebmasterSettings->latest_news_section_id); // Page Title, Description, Keywords $seo_title_var = "seo_title_" . @Helper::currentLanguage()->code; $seo_description_var = "seo_description_" . @Helper::currentLanguage()->code; $seo_keywords_var = "seo_keywords_" . @Helper::currentLanguage()->code; $tpc_title_var = "title_" . @Helper::currentLanguage()->code; $site_desc_var = "site_desc_" . @Helper::currentLanguage()->code; $site_keywords_var = "site_keywords_" . @Helper::currentLanguage()->code; if ($Topic->$seo_title_var != "") { $PageTitle = $Topic->$seo_title_var; } else { $PageTitle = $Topic->$tpc_title_var; } if ($Topic->$seo_description_var != "") { $PageDescription = $Topic->$seo_description_var; } else { $PageDescription = $WebsiteSettings->$site_desc_var; } if ($Topic->$seo_keywords_var != "") { $PageKeywords = $Topic->$seo_keywords_var; } else { $PageKeywords = $WebsiteSettings->$site_keywords_var; } // .. end of .. Page Title, Description, Keywords $positions = [ 'International Executive Officers', // 'Lions Council of India Executive', 'LCI Board of Director Appointees', 'LCIF Board of Trustees Appointees', 'Past International Presidents-Heavenly Abode', 'International Directors from ISAME', 'Past International Directors', 'Global Action Team', 'Lions Club International Foundation', 'LCI Board of Director', 'LCIF Board of Trustees', 'LEO Lion Board Liaisons', 'LCI Board of directors - ISAME', 'LCI Board of Trustees - ISAME' ]; // $members = Member::where('international', '=', '1')->get(); // $members = Member::where('international', '=', '1') // ->whereIn('position', $positions) // ->get(); // $members = Member::whereIn('position', $positions)->get(); $members = Member::whereIn('position', $positions)->orderby('sort','asc')->get(); $International_Executive_Officers = []; // $LCOI_Executive = []; $LCI_Board_of_Director_Appointees = []; $LCIF_Board_of_Trustees_Appointees = []; $Past_International_Presidents_Heavenly_Abode = []; $International_Directors_from_ISAME = []; $Past_International_Directors = []; $Global_Action_Team = []; $Lions_Club_International_Foundation = []; $LCI_Board_of_Director = []; $LCIF_Board_of_Trustees = []; $LEO_Lion_Board_Liaisons = []; $LCI_Board_of_directors_ISAME =[]; $LCI_Board_of_Trustees_ISAME = []; if($members->count()>0){ foreach ($members as $member) { $member->camelCaseName = preg_replace_callback('/(?:^|\s|\.)[a-z]/', function ($matches) { return strtoupper($matches[0]); }, strtolower($member->full_name)); switch ($member->position) { case 'International Executive Officers': $International_Executive_Officers[] = $member; break; // case 'Lions Council of India Executive': // $LCOI_Executive[] = $member; // break; case 'LCI Board of Director Appointees': $LCI_Board_of_Director_Appointees[] = $member; break; case 'LCIF Board of Trustees Appointees': $LCIF_Board_of_Trustees_Appointees[] = $member; break; case 'Past International Presidents-Heavenly Abode': $Past_International_Presidents_Heavenly_Abode[] = $member; break; case 'International Directors from ISAME': $International_Directors_from_ISAME[] = $member; break; case 'Past International Directors': $Past_International_Directors[] = $member; break; case 'Global Action Team': $Global_Action_Team[] = $member; break; case 'Lions Club International Foundation': $Lions_Club_International_Foundation[] = $member; break; case 'LCI Board of Director': $LCI_Board_of_Director[] = $member; break; case 'LCIF Board of Trustees': $LCIF_Board_of_Trustees[] = $member; break; case 'LEO Lion Board Liaisons': $LEO_Lion_Board_Liaisons[] = $member; break; case 'LCI Board of directors - ISAME': $LCI_Board_of_directors_ISAME[] = $member; break; case 'LCI Board of Trustees - ISAME': $LCI_Board_of_Trustees_ISAME[] = $member; break; } } } return view("frontEnd.internationaldirectory", compact("WebsiteSettings", "WebmasterSettings", "LatestNews", "Topic", "SideBanners", "WebmasterSection", "Categories", "CurrentCategory", "PageTitle", "PageDescription", "PageKeywords", "TopicsMostViewed", "International_Executive_Officers", // "LCOI_Executive", "LCI_Board_of_Director_Appointees", "LCIF_Board_of_Trustees_Appointees", "Past_International_Presidents_Heavenly_Abode", "International_Directors_from_ISAME", "Past_International_Directors", "Global_Action_Team", "Lions_Club_International_Foundation", "LCI_Board_of_Director", "LCIF_Board_of_Trustees", "LEO_Lion_Board_Liaisons", "LCI_Board_of_directors_ISAME", "LCI_Board_of_Trustees_ISAME" )); } else { return redirect()->action('HomeController@HomePage'); } } else { return redirect()->action('HomeController@HomePage'); } return view('indialeaders'); } // public function autocomplete(Request $request) // { // $search = $request->get('term'); // $result = Member::where('full_name', 'LIKE', '%'. $search .'%') // ->orWhere('email_id', 'LIKE', '%'. $search .'%') // ->orWhere('mobile_numbers', 'LIKE', '%'. $search .'%') // ->take(10) // // ->get(['id', 'full_name as value']); // ->get(['id', 'full_name', 'position', 'district']); // return response()->json($result); // } public function autocomplete(Request $request) { $search = $request->get('term'); $result = Member::where('full_name', 'LIKE', '%' . $search . '%') ->orWhere('email_id', 'LIKE', '%' . $search . '%') ->orWhere('mobile_numbers', 'LIKE', '%' . $search . '%') ->take(10) ->get(['id', 'full_name', 'position', 'district']); // Transform the result to replace null values with empty strings $transformedResult = $result->map(function ($item) { $item->position = $item->position ?? ''; $item->district = $item->district ?? ''; return $item; }); return response()->json($transformedResult); } // public function autocomplete(Request $request) // { // $search = $request->get('term'); // $result = Member::where('full_name', 'LIKE', '%' . $search . '%') // ->orWhere('email_id', 'LIKE', '%' . $search . '%') // ->orWhere('mobile_numbers', 'LIKE', '%' . $search . '%') // ->take(10) // ->get(['id', 'full_name', 'position', 'district']); // // Format the result for display // $formattedResult = $result->map(function($item) { // return [ // 'id' => $item->id, // 'label' => $item->full_name . ' - ' . $item->position . ', ' . $item->district, // 'value' => $item.id // ]; // }); // return response()->json($formattedResult); // } public function edit($id) { $member = Member::findOrFail($id); $webmasterId = 75; $GeneralWebmasterSections = WebmasterSection::where('status', '=', '1')->orderby('row_no', 'asc')->get(); // General END //Webmaster Topic Details $WebmasterSection = WebmasterSection::find($webmasterId); if (!empty($WebmasterSection)) { $statics = []; foreach ($WebmasterSection->customFields as $customField) { if ($customField->in_statics && ($customField->type == 6 || $customField->type == 7)) { $cf_details_var = "details_" . @Helper::currentLanguage()->code; $cf_details_var2 = "details_en" . env('DEFAULT_LANGUAGE'); if ($customField->$cf_details_var != "") { $cf_details = $customField->$cf_details_var; } else { $cf_details = $customField->$cf_details_var2; } $cf_details_lines = preg_split('/\r\n|[\r\n]/', $cf_details); $line_num = 1; $statics_row = []; foreach ($cf_details_lines as $cf_details_line) { if ($customField->type == 6) { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", $line_num); } else { $tids = TopicField::select("topic_id")->where("field_id", $customField->id)->where("field_value", 'like', '%' . $line_num . '%'); } $Topics_count = Topic::where('webmaster_id', '=', $WebmasterSection->id)->wherein('id', $tids)->count(); $statics_row[$line_num] = $Topics_count; $line_num++; } $statics[$customField->id] = $statics_row; } } // if($webmasterId == 75){ $members = Member::get(); // // dd($members) // return view("dashboard.topics.directory-list", compact("GeneralWebmasterSections", "WebmasterSection","members", "statics")); return view("dashboard.topics.membersedit", compact("GeneralWebmasterSections", "WebmasterSection", "statics","members","member")); } } // public function update(Request $request, $id) // { // $request->validate([ // 'full_name' => 'required|string|max:255', // // 'mobile_numbers' => 'required|string|max:255', // // 'district' => 'required|string|max:255', // ]); // $member = Member::findOrFail($id); // $member->update($request->all()); // return redirect()->route('members')->with('success', 'Member updated successfully.'); // } // public function update(Request $request, $id) // { // $request->validate([ // 'full_name' => 'required|string|max:255', // // 'mobile_numbers' => 'required|string|max:255', // // 'district' => 'required|string|max:255', // ]); // $member = Member::findOrFail($id); // $data = $request->all(); // if ($request->hasFile('photo')) { // $file = $request->file('photo'); // $originalName = $file->getClientOriginalName(); // $path = $this->uploadPath; // // Check if the file already exists // $filePath = $path . '/' . $originalName; // if (file_exists($filePath)) { // $originalName = time() . '_' . $originalName; // } // $file->move($path, $originalName); // $data['photo'] = $originalName; // // Optionally, delete the old photo if it exists // if ($member->photo && file_exists($path . '/' . $member->photo)) { // unlink($path . '/' . $member->photo); // } // } else { // // Preserve the old photo if no new photo is uploaded // $data['photo'] = $member->photo; // } // $member->update($data); // return redirect()->route('members')->with('success', 'Member updated successfully.'); // } // public function update(Request $request, $id) // { // $request->validate([ // 'full_name' => 'required|string|max:255', // 'category' => 'nullable|string|max:255', // 'slogan' => 'nullable|string|max:255', // // 'mobile_numbers' => 'required|string|max:255', // // 'district' => 'required|string|max:255', // ]); // $member = Member::findOrFail($id); // $data = $request->all(); // if ($request->filled('custom_position')) { // $data['position'] = $request->input('custom_position'); // } else { // $data['position'] = $request->input('dropdown_position'); // } // if ($request->hasFile('photo')) { // $file = $request->file('photo'); // $originalName = $file->getClientOriginalName(); // $timestamp = time(); // $path = $this->uploadPath; // $newFileName = $timestamp . '_' . $originalName; // // Optionally, delete the old photo if it exists // if ($member->photo && file_exists($path . '/' . $member->photo)) { // unlink($path . '/' . $member->photo); // } // $file->move($path, $newFileName); // Move the file to the specified path with the new name // $data['photo'] = $newFileName; // Save the new name in the data array // } else { // // Preserve the old photo if no new photo is uploaded // $data['photo'] = $member->photo; // } // $dobInput = $request->input('dob'); // if (!empty($dobInput)) { // $dobParts = explode('/', $dobInput); // if (count($dobParts) > 1) { // $data['dob'] = $dobParts[2] . '-' . $dobParts[1] . '-' . $dobParts[0]; // } else { // $data['dob'] = $dobInput; // } // } // $member->update($data); // return redirect()->route('members')->with('success', 'Member updated successfully.'); // } public function update(Request $request, $id) { // Validate request data $request->validate([ 'full_name' => 'required|string|max:255', 'full_address' => 'nullable|string|max:255', 'mobile_numbers' => 'nullable|string|max:255', 'position' => 'nullable|string|max:255', 'custom_position' => 'nullable|string|max:255', ]); // Find existing member $member = Member::findOrFail($id); // Prepare data for update $data = $request->all(); // Determine which position to use // if ($request->filled('custom_position')) { // $data['position'] = $request->input('custom_position'); // } else { // $data['position'] = $request->input('dropdown_position'); // } // Handle photo upload if ($request->hasFile('photo')) { $file = $request->file('photo'); $originalName = $file->getClientOriginalName(); $timestamp = time(); $path = $this->uploadPath; $newFileName = $timestamp . '_' . $originalName; // Delete old photo if it exists if ($member->photo && file_exists($path . '/' . $member->photo)) { @unlink($path . '/' . $member->photo); } // Move new photo and update data $file->move($path, $newFileName); $data['photo'] = $newFileName; } // Handle date of birth formatting if ($request->filled('dob')) { $dobParts = explode('/', $request->input('dob')); if (count($dobParts) === 3) { $data['dob'] = $dobParts[2] . '-' . $dobParts[1] . '-' . $dobParts[0]; // YYYY-MM-DD } } // Update the member record $member->update($data); // Redirect with success message return redirect()->route('members')->with('success', 'Member updated successfully.'); } public function destroy($id) { $member = Member::findOrFail($id); $member->delete(); return response()->json(['success' => 'Member deleted successfully']); return redirect()->route('members')->with('success', 'Member deleted successfully.'); } public function deletePhoto($id) { $member = Member::findOrFail($id); if ($member->photo) { \Storage::delete($member->photo); $member->photo = null; $member->save(); } // return redirect()->route('members')->with('success', 'Photo deleted successfully.'); return redirect()->back()->with('success', 'Photo deleted successfully.'); } }
Close