/** * Show the application dashboard to the user. * * @return Response */ public function Home() { $lc = app()->getlocale(); $channel = \Model\Channel\ModelName::general(); if ($lc == 'kg') { $generalPosts = \Model\Post\ModelName::general($channel)->published()->languagekg()->take(6)->skip(0)->orderBy('id', 'desc')->get(); $projects = \Model\Project\ModelName::having('name', '<>', '')->get(); } elseif ($lc == 'ru') { $generalPosts = \Model\Post\ModelName::general($channel)->published()->languageru()->take(6)->skip(0)->orderBy('id', 'desc')->get(); $projects = \Model\Project\ModelName::where('nameRu', '<>', '')->get(); } $rDayVideo = \Model\Media\ModelName::having('dayVideo', '=', '1')->take(1)->skip(0)->orderBy('created_at', 'desc')->first(); if ($rDayVideo != null) { $dayVideo = $rDayVideo; } elseif ($rDayVideo == null) { $dayVideoResult = \Model\Media\ModelName::take(1)->skip(0)->orderBy('id', 'desc')->first(); if ($dayVideoResult != null) { $dayVideo = $dayVideoResult; } else { $dayVideo = 'KhJUlC4aJZM'; } } $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $peopleReporters = \Model\PeopleReporter\ModelName::where('published', '=', true)->get(); // FotoParent - photo gallery $photoParent = \Model\PhotoParent\ModelName::where('published', '=', true)->first(); if ($photoParent != null) { $images = json_decode($photoParent->images); // array of images } else { $images = 1; } $MediaCategories = \Model\MediaCategory\ModelName::get(); $mediaPosts = \Model\Media\ModelName::orderBy('id', 'desc')->get(); $categoriesVideos = array(); foreach ($MediaCategories as $MediaCategory) { $CategoryVideos = \Model\Media\ModelName::where('videoType', '=', $MediaCategory->videoType)->orderBy('id', 'desc')->take(9)->get(); $categoriesVideos = array_add($categoriesVideos, $MediaCategory->videoType, $CategoryVideos); } $mediaLastVideos = \Model\Media\ModelName::orderBy('id', 'desc')->take(9)->get(); return view('Front::home', ['images' => $images, 'generalPosts' => $generalPosts, 'dayVideo' => $dayVideo, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'peopleReporters' => $peopleReporters, 'backgroundMain' => $backgroundMain, 'MediaCategories' => $MediaCategories, 'categoriesVideos' => $categoriesVideos, 'mediaLastVideos' => $mediaLastVideos, 'projects' => $projects]); }
/** * Show the application dashboard to the user. * * @return Response */ public function Home() { $lc = app()->getlocale(); $channel = \Model\Channel\ModelName::general(); $channels = \Model\Channel\ModelName::take(8)->skip(1)->get(); if ($lc == 'kg') { $generalPosts = \Model\Post\ModelName::general($channel)->published()->where('general', '=', '1')->languagekg()->take(6)->skip(0)->orderBy('number', 'asc')->get(); $projects = \Model\Project\ModelName::having('name', '<>', '')->get(); $directorPosts = \Model\Post\ModelName::where('director', '=', '1')->orderBy('id', 'desc')->take(3)->languagekg()->get(); $reporterPosts = \Model\Post\ModelName::where('reporter', '=', '1')->orderBy('id', 'desc')->take(15)->languagekg()->get(); } elseif ($lc == 'ru') { $generalPosts = \Model\Post\ModelName::general($channel)->published()->where('general', '=', '1')->languageru()->take(6)->skip(0)->orderBy('number', 'asc')->get(); $projects = \Model\Project\ModelName::where('nameRu', '<>', '')->get(); $directorPosts = \Model\Post\ModelName::where('director', '=', '1')->orderBy('id', 'desc')->take(3)->languageru()->get(); $reporterPosts = \Model\Post\ModelName::where('reporter', '=', '1')->orderBy('id', 'desc')->take(15)->languageru()->get(); } if ($lc == 'kg') { $latestPosts = \Model\Post\ModelName::general($channel)->published()->where('general', '=', '1')->languagekg()->take(6)->skip(0)->orderBy('id', 'desc')->get(); } elseif ($lc == 'ru') { $latestPosts = \Model\Post\ModelName::general($channel)->published()->where('general', '=', '1')->languageru()->take(6)->skip(0)->orderBy('id', 'desc')->get(); } $dayVideo1 = \Model\Media\ModelName::where('dayVideo', '=', '1')->first(); $dayVideo2 = \Model\Media\ModelName::where('dayVideo', '=', '2')->first(); $dayVideo3 = \Model\Media\ModelName::where('dayVideo', '=', '3')->first(); $dayVideo4 = \Model\Media\ModelName::where('dayVideo', '=', '4')->first(); $dayVideo5 = \Model\Media\ModelName::where('dayVideo', '=', '5')->first(); if ($dayVideo1) { $dayVideo1 = $dayVideo1; } else { $dayVideo1 = ''; } if ($dayVideo2) { $dayVideo2 = $dayVideo2; } else { $dayVideo2 = ''; } if ($dayVideo3) { $dayVideo3 = $dayVideo3; } else { $dayVideo3 = ''; } if ($dayVideo4) { $dayVideo4 = $dayVideo4; } else { $dayVideo4 = ''; } $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $peopleReporters = \Model\PeopleReporter\ModelName::where('published', '=', true)->get(); // Photo Gallery $photoGalleries = \Model\PhotoParent\ModelName::where('extracolumn', '=', '1')->where('published', '=', true)->take('10')->orderBy('id', 'desc')->get(); $MediaCategories = \Model\MediaCategory\ModelName::orderBy('id', 'asc')->get(); $mediaPosts = \Model\Media\ModelName::orderBy('id', 'desc')->get(); $categoriesVideos = array(); foreach ($MediaCategories as $MediaCategory) { $CategoryVideos = \Model\Media\ModelName::where('videoType', '=', $MediaCategory->videoType)->orderBy('id', 'desc')->take(9)->get(); $categoriesVideos = array_add($categoriesVideos, $MediaCategory->videoType, $CategoryVideos); } $mediaLastVideos = \Model\Media\ModelName::orderBy('id', 'desc')->take(9)->get(); $defaultVideo = 'rjXSurFi8uQ'; return view('Front::home', ['generalPosts' => $generalPosts, 'dayVideo1' => $dayVideo1, 'dayVideo2' => $dayVideo2, 'dayVideo3' => $dayVideo3, 'dayVideo4' => $dayVideo4, 'defaultVideo' => $defaultVideo, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionLeft' => $this->positionLeft, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'peopleReporters' => $peopleReporters, 'photoGalleries' => $photoGalleries, 'backgroundMain' => $backgroundMain, 'MediaCategories' => $MediaCategories, 'categoriesVideos' => $categoriesVideos, 'mediaLastVideos' => $mediaLastVideos, 'projects' => $projects, 'directorPosts' => $directorPosts, 'reporterPosts' => $reporterPosts, 'latestPosts' => $latestPosts, 'channels' => $channels]); }