MainController.php
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\Http\Controllers;
use App\Models\Banner;
use App\Models\Category;
use App\Models\Good;
use App\Models\News;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Session\Storage;
class MainController extends Controller
{
// Главная страница
public function index() {
$banners = Banner::query()->orderBy('id')->get();
$category = Category::query()->where('parent_id', '>', '0')->orderBy('id')->get();
$goods_new = Good::query()->where('new', '=', '1')->orderBy('id')->paginate(8);
$goods_stock = Good::query()->where('stock_count', '>', '0')->orderBy('id')->paginate(8);
$goods_demo = Good::query()->where('demo', '=', '1')->orderBy('id')->paginate(8);
$goods_way = Good::query()->where('way', '=', '1')->orderBy('id')->paginate(8);
$news = News::query()->orderByDesc('id')->paginate(3);
return view('index',
compact('banners', 'category', 'goods_new', 'goods_stock',
'goods_demo', 'goods_way', 'news'));
}
public function about_company() {
return view('company');
}
public function catalog() {
$category = Category::query()->orderBy('id')->get();
return view('catalog', compact('category'));
}
public function good() {
return view('good');
}
public function simple_good() {
return view('simple_good');
}
}