From 9a5d84dc0df46d7dc91edbe9e5879c0a5ee34ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=20=D0=9B=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Tue, 7 Mar 2023 21:01:44 +0700 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1?= =?UTF-8?q?=86=D0=B8=D1=8F=20=D0=B8=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1?= =?UTF-8?q?=80=D0=B0=D1=86=D0=B8=D1=8F.=20=D0=A4=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B8=20=D1=81=D0=BE=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0?= =?UTF-8?q?=BE=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .htaccess | 4 +- app/Http/Controllers/LoginController.php | 2 +- app/Http/Controllers/MainController.php | 67 +- app/Http/Controllers/RegisterController.php | 2 +- app/Http/Middleware/Authenticate.php | 2 +- app/Http/Middleware/RedirectIfAuthenticated.php | 3 +- .../2023_03_01_073202_create_houses_table.php | 2 +- resources/views/admin/index.blade.php | 40 +- resources/views/ajax/complex/category.blade.php | 14 + resources/views/category_catalog.blade.php | 651 ++++---------------- resources/views/favorite.blade.php | 6 +- resources/views/layout/site.blade.php | 50 +- resources/views/part/filter/category.blade.php | 2 +- routes/web.php | 3 + 14 files changed, 268 insertions(+), 580 deletions(-) create mode 100644 resources/views/ajax/complex/category.blade.php diff --git a/.htaccess b/.htaccess index c5563e9..430f730 100644 --- a/.htaccess +++ b/.htaccess @@ -1,5 +1,7 @@ RewriteEngine on - RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L] + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] \ No newline at end of file diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php index eb4b917..46fbfc0 100644 --- a/app/Http/Controllers/LoginController.php +++ b/app/Http/Controllers/LoginController.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Auth; class LoginController extends Controller { public function __construct() { - //$this->middleware('guest')->except('logout'); + $this->middleware('guest')->except('logout'); } //Форма входа diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 544f704..02fa54a 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -187,6 +187,10 @@ class MainController extends Controller return view('favorite'); } + public function Category_ajax($cat, Request $request) { + return $cat; + } + /* * Категории каталога Аренда/Продажа/Бизнес */ @@ -211,10 +215,67 @@ class MainController extends Controller } $houses = House::with('areas')-> - where('format_house', '=', $format_house)->paginate(4)->appends(request()->query()); - //->appends(request()->query()); + where('format_house', '=', $format_house); + //->appends(request()->query()); + /* + if (!empty($request->area)) { + $houses = $houses->where('area_id', '=', $request->area); + } + // условия поиска по типу недвижимости + if (!empty($request->type_area)) { + $houses = $houses->where('type_area_id', '=', $request->type_area); + } + // условия поиска по формату недвижимости + if (!empty($request->format_area)) { + $houses = $houses->where('format_area_id', '=', $request->format_area); + } + // условия поиска по площади - минимальная площадь + if (!empty($request->area_m2_min)) { + $houses = $houses->where('area', '>', $request->area_m2_min); + } + // условия поиска по площади - максимальная площадь + if (!empty($request->area_m2_max)) { + $houses = $houses->where('area', '<', $request->area_m2_max); + } + // условия поиска по цене - минимальная цена + if (!empty($request->price_min)) { + $houses = $houses->where('price', '>', $request->price_min); + } + // условия поиска по цене - максимальная цена + if (!empty($request->price_max)) { + $houses = $houses->where('price', '<', $request->price_max); + } + // условия поиска по адресу + if (!empty($request->address)) { + $houses = $houses->where('address', 'LIKE', "%".$request->address."%"); + } + + if (!empty($request->sort_price)) { + switch ($request->sort_price) { + case 1: $houses = $houses->orderBy('price');break; + case 2: $houses = $houses->orderByDesc('price');break; + } + switch ($request->sort_new) { + case 1: $houses = $houses->orderByDesc('created_at');break; + case 2: $houses = $houses->orderBy('created_at');break; + } + switch ($request->sort_area) { + case 1: $houses = $houses->orderByDesc('area')->get();break; + case 2: $houses = $houses->orderBy('area')->get();break; + } + } else { + $houses = $houses->orderBy('price')-> + orderByDesc('created_at')-> + orderByDesc('area'); + } +*/ + $houses = $houses->paginate(4); + + if ($request->ajax()) { + return view('ajax.complex.category', compact('houses')); + } - return view('category_catalog', compact('title', 'houses')); + return view('category_catalog', compact('title', 'cat', 'houses')); } diff --git a/app/Http/Controllers/RegisterController.php b/app/Http/Controllers/RegisterController.php index d505086..cb689ec 100644 --- a/app/Http/Controllers/RegisterController.php +++ b/app/Http/Controllers/RegisterController.php @@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Hash; class RegisterController extends Controller { public function __construct() { - //$this->middleware('guest'); + $this->middleware('guest'); } // Форма регистрации diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 704089a..67c7daf 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -15,7 +15,7 @@ class Authenticate extends Middleware protected function redirectTo($request) { if (! $request->expectsJson()) { - return route('login'); + return route('auth.login'); } } } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index a2813a0..c04c2ee 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -23,7 +23,8 @@ class RedirectIfAuthenticated foreach ($guards as $guard) { if (Auth::guard($guard)->check()) { - return redirect(RouteServiceProvider::HOME); + //return redirect(RouteServiceProvider::HOME); + return redirect()->route('user.index'); } } diff --git a/database/migrations/2023_03_01_073202_create_houses_table.php b/database/migrations/2023_03_01_073202_create_houses_table.php index 7316e85..196ed42 100644 --- a/database/migrations/2023_03_01_073202_create_houses_table.php +++ b/database/migrations/2023_03_01_073202_create_houses_table.php @@ -48,7 +48,7 @@ return new class extends Migration $table->integer('price_m2')->default(0); $table->integer('rent_in_year')->default(0); $table->integer('rent_in_month')->default(0); - $table->string('scheme_deal')->default('Прямая аренда'); + $table->string('scheme_deal', 255)->default('Прямая аренда'); $table->string('present', 255)->default(''); $table->string('object_plan', 255)->default(''); $table->string('floor_plan', 255)->default(''); diff --git a/resources/views/admin/index.blade.php b/resources/views/admin/index.blade.php index e2c0f81..30f5fc9 100644 --- a/resources/views/admin/index.blade.php +++ b/resources/views/admin/index.blade.php @@ -1,7 +1,41 @@ @extends('layout.site', ['title' => 'Личный кабинет']) @section('content') -

Личный кабинет

-

Добрый день {{ auth()->user()->name }}!

-

Это личный кабинет пользователя сайта.

+
+
+
+ +

Личный кабинет

+

+ Добрый день {{ auth()->user()->name }}!
+ Это личный кабинет пользователя сайта.
+ Выйти из системы
+

+
+
+
+
+
+
+
+

Найдите идеальную планировку на сайте Renttorg

+
+
+
+

Нажмите на для добавления недвижемости в избранное

+
+
+
+

Перейдите в избранное или сравнение для выбора планировки

+
+
+
+
+
@endsection + diff --git a/resources/views/ajax/complex/category.blade.php b/resources/views/ajax/complex/category.blade.php new file mode 100644 index 0000000..240ef0a --- /dev/null +++ b/resources/views/ajax/complex/category.blade.php @@ -0,0 +1,14 @@ +
+@if ($houses->count()) + @foreach ($houses as $house1) + @include('catalogs.house_mini', ['house' => $house1]) + @endforeach + +@else +

Здесь пока что нет предложений

+@endif +
+ + diff --git a/resources/views/category_catalog.blade.php b/resources/views/category_catalog.blade.php index 726c221..cbb6be6 100644 --- a/resources/views/category_catalog.blade.php +++ b/resources/views/category_catalog.blade.php @@ -4,13 +4,117 @@ @include('part.filter.category', ['title' => $title]) @endsection +@section('custom_js') + +@endsection + @section('content')
-

Аренда торговых помещений

-
Найдено объектов по Вашему запросу: 356
+

{{ $title }}

+
Найдено объектов по Вашему запросу: {{ $houses->count() }}
@@ -39,6 +143,7 @@
+
@if ($houses->count()) @foreach ($houses as $house1) @@ -47,547 +152,11 @@ @else

Здесь пока что нет предложений

@endif -
diff --git a/resources/views/favorite.blade.php b/resources/views/favorite.blade.php index bd305ee..21e18c9 100644 --- a/resources/views/favorite.blade.php +++ b/resources/views/favorite.blade.php @@ -6,11 +6,11 @@
-

Тут пока что ничего нет...

Выберите идеальную недвижимость +

Тут пока что ничего нет...

Выберите идеальную недвижимость

Здесь вы можете ознакомиться с недвижимостью которая вам понравилось

@@ -19,7 +19,7 @@
-

Найдите идеальную планировку на сайте Renttorg

+

Найдите идеальную планировку на сайте Renttorg

diff --git a/resources/views/layout/site.blade.php b/resources/views/layout/site.blade.php index 4184110..b9f610c 100644 --- a/resources/views/layout/site.blade.php +++ b/resources/views/layout/site.blade.php @@ -79,31 +79,36 @@
- @if ($message = Session::get('success')) - - @endif - @if ($errors->any()) - - @endif @yield('filter') + @if ($message = Session::get('success')) +
+ +
+ @endif + + @if ($errors->any()) +
+ +
+ @endif @yield('content') @@ -123,7 +128,7 @@
- @yield('form_feedback'); + @yield('form_feedback') -