public function post(\Model\Post\ModelName $post) { $lc = app()->getlocale(); $post->incrementViewed(); // Photo Gallery $parent = \Model\PhotoParent\ModelName::where('id', '=', $post->parentId)->first(); if ($parent) { $images = json_decode($parent->images); } else { $images = null; } $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::rs.post', ['post' => $post, 'backgroundMain' => $backgroundMain, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'positionLeft' => $this->positionLeft, 'images' => $images]); }
public function news(\Model\Post\ModelName $post) { $post->incrementViewed(); $channel = \Model\Channel\ModelName::name('dostuk')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $dostukProjects = \Model\Project\ModelName::where('published', '=', true)->where('dostuk', '=', 1)->get(); $parent = \Model\PhotoParent\ModelName::where('id', '=', $post->parentId)->first(); if ($parent != null) { $images = json_decode($parent->images); } else { $images = null; } return view('Front::channel.dostuk.news', ['channel' => $channel, 'post' => $post, 'backgroundMain' => $backgroundMain, 'dostukProjects' => $dostukProjects, 'images' => $images]); }
public function categoryPage(\Model\Category\ModelName $category) { $category_id = $category->id; $posts = \Model\Post\ModelName::where('category_id', '=', $category_id)->get(); $positionTop = \Model\Banner\ModelName::where('positionTop', '=', '1')->first(); $positionRight = \Model\Banner\ModelName::where('positionRight', '=', '1')->first(); $positionCenter = \Model\Banner\ModelName::where('positionCenter', '=', '1')->first(); $positionBottom = \Model\Banner\ModelName::where('positionBottom', '=', '1')->first(); $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::category.index', ['posts' => $posts, 'category' => $category, 'positionTop' => $positionTop, 'positionRight' => $positionRight, 'positionCenter' => $positionCenter, 'positionBottom' => $positionBottom, 'categories' => $categories, 'backgroundMain' => $backgroundMain]); }
public function allnews() { $channel = \Model\Channel\ModelName::name('kyrgyzradio')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $lc = app()->getlocale(); if ($lc == 'kg') { $allPost = \Model\Post\ModelName::where('kyrgyzradio', '=', 1)->languagekg()->published()->orderBy('id', 'desc')->get(); } else { $allPost = \Model\Post\ModelName::where('kyrgyzradio', '=', 1)->languageru()->published()->orderBy('id', 'desc')->get(); } $kyrgyzradioProjects = \Model\Project\ModelName::where('published', '=', true)->where('kyrgyzradio', '=', 1)->get(); return view('Front::channel.kyrgyzradio.allnews', ['channel' => $channel, 'backgroundMain' => $backgroundMain, 'allPost' => $allPost, 'kyrgyzradioProjects' => $kyrgyzradioProjects]); }
public function twoRelatedFunction($postId, $postId2) { $relatedPost = \Model\Post\ModelName::where('id', '=', $postId)->first(); $relatedPost2 = \Model\Post\ModelName::where('id', '=', $postId2)->first(); return '<div> <aside> <div class="topics-box"> <h2>' . trans('site.MatpoTeme') . '</h2> <div class="topics"> <div class="topic clearfix"> <div class="t-date"> <span class="date"> <span class="time">' . $relatedPost->getTime() . '</span> ' . $relatedPost->getDay() . ' ' . $relatedPost->getMonthRu() . ', ' . $relatedPost->getYear() . ' </span> </div> <a class="t-thumb" href="' . route('front.post', $postId) . '"> <img alt="alt photo text" src="' . asset($relatedPost->getFile()) . '"> </a> <div class="t-info"> <a class="js-dh" href="' . route('front.post', $postId) . '">' . $relatedPost->getTitle() . '</a> </div> </div> <div class="topic clearfix"> <div class="t-date"> <span class="date"> <span class="time">' . $relatedPost2->getTime() . '</span> ' . $relatedPost2->getDay() . ' ' . $relatedPost2->getMonthRu() . ', ' . $relatedPost2->getYear() . ' </span> </div> <a class="t-thumb" href="' . route('front.post', $postId) . '"> <img alt="alt photo text" src="' . asset($relatedPost2->getFile()) . '"> </a> <div class="t-info"> <a class="js-dh" href="' . route('front.post', $postId) . '">' . $relatedPost2->getTitle() . '</a> </div> </div> </div> </div> </aside></div> '; }
public function filterResultCategory(Request $request) { $category_id = $request->category; $category = \Model\Category\ModelName::where('id', '=', $category_id)->first(); $lc = app()->getlocale(); $df = $request->dateFrom; $dt = $request->dateTo; $dateFrom = date('Y-m-d', strtotime($df)); $dateTo = date('Y-m-d', strtotime($dt)); $perPage = 10; $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); if ($lc == 'kg' and $df != '' and $dt != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datefromkg($df)->datetokg($dt)->orderBy('id', 'desc')->paginate($perPage); } elseif ($lc == 'kg' and $df != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datefromkg($df)->orderBy('id', 'desc')->paginate($perPage); } elseif ($lc == 'kg' and $dt != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datetokg($dt)->orderBy('id', 'desc')->paginate($perPage); } elseif ($lc == 'ru' and $df != '' and $dt != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datefromru($df)->datetoru($dt)->orderBy('id', 'desc')->paginate($perPage); } elseif ($lc == 'ru' and $df != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datefromru($df)->orderBy('id', 'desc')->paginate($perPage); } elseif ($lc == 'ru' and $dt != '') { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->datetoru($dt)->orderBy('id', 'desc')->paginate($perPage); } else { $postAllFromTo = \Model\Post\ModelName::published()->where('category_id', '=', $category_id)->orderBy('id', 'desc')->paginate($perPage); } return view('Front::category.index', ['perPage' => $perPage, 'category' => $category, 'posts' => $postAllFromTo, 'categories' => $categories, 'backgroundMain' => $backgroundMain]); }
public function directorPost(\Model\Post\ModelName $post) { $lc = app()->getlocale(); $post->incrementViewed(); $categories = \Model\Category\ModelName::all(); $positionTop = \Model\Banner\ModelName::top()->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); if ($post->parentId != '0' && $post->parentId != null) { $parentId = $post->parentId; $parentId = \Model\PhotoParent\ModelName::where('id', '=', $parentId)->first(); $photoChilds = \Model\PhotoChild\ModelName::where('parentId', '=', $parentId->id)->get(); } else { $parentId = '0'; $photoChilds = '0'; } if ($post->related1 != null) { $related1Post = \Model\Post\ModelName::where('id', '=', $post->related1)->first(); } else { $related1Post = null; } if ($post->related2 != null) { $related2Post = \Model\Post\ModelName::where('id', '=', $post->related2)->first(); } else { $related2Post = null; } if ($post->related3 != null) { $related3Post = \Model\Post\ModelName::where('id', '=', $post->related3)->first(); } else { $related3Post = null; } if ($lc == 'kg') { $relatedPosts = \Model\Post\ModelName::where('category_id', '=', $post->category_id)->languagekg()->take(6)->skip(0)->orderBy('id', 'desc')->get(); } elseif ($lc == 'ru') { $relatedPosts = \Model\Post\ModelName::where('category_id', '=', $post->category_id)->languageru()->take(6)->skip(0)->orderBy('id', 'desc')->get(); } return view('Front::pages.directorPost', ['post' => $post, 'related1Post' => $related1Post, 'related2Post' => $related2Post, 'related3Post' => $related3Post, 'relatedPosts' => $relatedPosts, 'parentId' => $parentId, 'photoChilds' => $photoChilds, 'categories' => $categories, 'positionTop' => $positionTop, 'backgroundMain' => $backgroundMain, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'positionLeft' => $this->positionLeft]); }
public function unnumber(Request $request, $number) { $postId = $number; $row = \Model\Post\ModelName::where('id', '=', $postId)->first(); $row->number = 99; $row->save(); return redirect()->route('admin.media.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Post $post) { $post->delete(); return redirect()->route('admin.post.index'); }
/** * Run the database seeds. * * @return void */ public function run() { \Model\Post\ModelName::truncate(); //factory(\Model\Post\ModelName::class, 10)->create(); }
public function broadcasts(\Model\Project\ModelName $project) { $lc = app()->getlocale(); if ($lc == 'kg' && $project->name != '') { } elseif ($lc == 'ru' && $project->nameRu != '') { } else { return redirect()->route('birinchi.home'); } $projectList = \Model\Project\ModelName::get(); // $MediaCategory = \Model\MediaCategory\ModelName::get(); $mediaAll = \Model\Media\ModelName::get(); $mainBanner = \Model\Background\ModelName::where('name', '=', 'main')->first(); $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $relatedNews = \Model\Post\ModelName::where('published', '=', true)->where('birinchi', '=', '1')->where('birinchiProgram', '=', $project->id)->get(); // dd($relatedNews); $lc = app()->getlocale(); if ($lc == 'kg') { $birinchiProjects = \Model\Project\ModelName::where('published', '=', true)->where('birinchi', '=', 1)->where('name', '<>', '')->get(); } else { $birinchiProjects = \Model\Project\ModelName::where('published', '=', true)->where('birinchi', '=', 1)->where('nameRu', '<>', '')->get(); } return view('Front::channel.birinchi.broadcasts', ['project' => $project, 'mainBanner' => $mainBanner, 'categories' => $categories, 'projectList' => $projectList, 'backgroundMain' => $backgroundMain, 'relatedNews' => $relatedNews, 'birinchiProjects' => $birinchiProjects]); }
public function searchResult(Request $request) { $posts = \Model\Post\ModelName::search($request->input('search'))->get(); $pages = \Model\Page\ModelName::search($request->input('search'))->get(); return view('Front::result', ['posts' => $posts, 'pages' => $pages]); }