Example #1
0
 public function post_year($year)
 {
     // возвращаем посты за year
     # обращаемся к моделе Category
     $Categories = new Categories();
     $categories = $Categories->cats_for_header();
     # обращаемся к моделе Page
     $pages = new Page();
     $footer_pages = $pages->footer_pages();
     $Posts_model = new Posts();
     $posts = $Posts_model->post_of_year($year);
     return view('layouts.default', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
 }
 public function index()
 {
     # обращаемся к моделе Category
     $vrode_model = new Categories();
     $categories = $vrode_model->cats_for_header();
     # обращаемся к моделе Page
     $pages = new Page();
     $footer_pages = $pages->footer_pages();
     //Получение разбитого на страницы запроса из базы данных:
     $postsi = new Posts();
     $per_page = 10;
     $posts = $postsi->post_paginate($per_page);
     return view('layouts.default', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
 }
Example #3
0
 public function index($slug)
 {
     # обращаемся к моделе Category
     $vrode_model = new Categories();
     $categories = $vrode_model->cats_for_header();
     // проверка на правильнось данных
     /*
     $post = DB::table('pages')
     ->where('slug', '=', "$slug")
     
     ->get();
     */
     # обращаемся к моделе Page
     $pages = new Page();
     $footer_pages = $pages->footer_pages();
     $post = $pages->page_text($slug);
     return view('layouts.page_lay', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'post_content', 'post' => $post]);
 }
Example #4
0
 public function index($id = 0)
 {
     # обращаемся к моделе Category
     $vrode_model = new Categories();
     $categories = $vrode_model->cats_for_header();
     # обращаемся к моделе Page
     $pages = new Page();
     $footer_pages = $pages->footer_pages();
     if ($id == 0 || empty($id)) {
         //Нету номера выводим рандомную цытату
         $ex_id = mt_rand(1, 366);
     } else {
         // выведем цытату с номером в заросе
         if ($id > 366 || $id <= 0) {
             return view('errors.404');
         }
         $ex_id = $id;
     }
     $excerptions_model = new Excerptions();
     $ex = $excerptions_model->index($ex_id);
     return view('layouts.default', ['categories' => $categories, 'pages' => $footer_pages, 'ex' => $ex, 'content_layout' => 'ex_content']);
 }
 public function index($slug = 0)
 {
     # обращаемся к моделе Category
     $category_model = new Categories();
     $categories = $category_model->cats_for_header();
     # обращаемся к моделе Page
     $pages = new Page();
     $footer_pages = $pages->footer_pages();
     if (isset($slug) && !empty($slug)) {
         //категория есть, выводим по ней посты
         //тут нужно сначала проверить категорию и вытащить ее айди
         $cat_id = $category_model->select_cat($slug);
         $postsi = new Posts();
         $posts = $postsi->post_of_category($slug);
         return view('layouts.category_lay', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
     } else {
         //категория не указана, выводим список категорий
         // зделаем запрос на категорию с картинкой и количеством постов внем
         $posts = $category_model->cats_page();
         return view('layouts.categories_lay', ['categories' => $categories, 'pages' => $footer_pages, 'content_layout' => 'posts_content', 'posts' => $posts]);
     }
     // return view('layouts.default',['categories' => $categories]);
 }