MainController.php
3.6 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
namespace App\Http\Controllers;
use App\Models\Area;
use App\Models\House;
use App\Models\News;
use App\Models\Partners;
use Illuminate\Http\Request;
use App\Classes\RusDate;
class MainController extends Controller
{
/*
* Главная страница проекта
*/
public function index() {
$houses = House::with('areas')->orderByDesc('created_at')->limit(8)->get();
$news = News::query()->orderByDesc('created_at')->limit(8)->get();
$partners = Partners::query()->limit(18)->get();
return view('index', compact('houses', 'news', 'partners'));
}
/*
* Страница ЖК
*/
public function Complex(Area $area) {
$house_arenda = House::with('areas')->
where('area_id', '=', $area->id)->
where('format_house', '=', 'Аренда')->
orderByDesc('created_at')->get();
$house_prodaja = House::with('areas')->
where('area_id', '=', $area->id)->
where('format_house', '=', 'Продажа')->
orderByDesc('created_at')->get();
$house_bissnes = House::with('areas')->
where('area_id', '=', $area->id)->
where('format_house', '=', 'Бизнес')->
orderByDesc('created_at')->get();
$house_arendovannie = House::with('areas')->
where('area_id', '=', $area->id)->
where('format_house', '=', 'Арендованные')->
orderByDesc('created_at')->get();
return view('complex', compact('area',
'house_arenda',
'house_prodaja',
'house_bissnes',
'house_arendovannie'));
}
/*
* О компании
*/
public function About() {
return view('about');
}
/*
* Избранное
*/
public function Favorite() {
return view('favorite');
}
/*
* Каталог
*/
public function Catalog() {
return view('catalog');
}
/*
* Новости
*/
public function News() {
//$news = News::orderByDesc('created_at')->limit(1)->paginate();
$news_ = News::query()->orderByDesc('created_at')->paginate(4);
return view('news', compact('news_'));
}
/*
* Контакты
*/
public function Contact() {
return view('contact');
}
/*
* Карта объектов
*/
public function MapsObj() {
return view('mapsobj');
}
/*
* Посмотр конктретного предложение офиса
*/
public function Offer(House $house) {
$houses = House::with('areas');
$houses = $houses->where('type_area_id', '=', $house->typearea->id);
$houses = $houses->where('format_house', '=', $house->format_house);
$houses = $houses->orderByDesc('created_at')->limit(8)->get();
return view('house.post', compact('house', 'houses'));
}
/*
* Просмотр детально конкретной новости
*/
public function DetailNew(News $news) {
$news_list = News::query()->orderByDesc('created_at')->limit(8)->get();
return view('new.post', compact('news', 'news_list'));
}
}