diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 02fa54a..039b1c9 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -187,10 +187,6 @@ class MainController extends Controller return view('favorite'); } - public function Category_ajax($cat, Request $request) { - return $cat; - } - /* * Категории каталога Аренда/Продажа/Бизнес */ @@ -217,7 +213,7 @@ class MainController extends Controller $houses = House::with('areas')-> where('format_house', '=', $format_house); //->appends(request()->query()); - /* + if (!empty($request->area)) { $houses = $houses->where('area_id', '=', $request->area); } @@ -250,7 +246,7 @@ class MainController extends Controller $houses = $houses->where('address', 'LIKE', "%".$request->address."%"); } - if (!empty($request->sort_price)) { + if (isset($request->sort_price)) { switch ($request->sort_price) { case 1: $houses = $houses->orderBy('price');break; case 2: $houses = $houses->orderByDesc('price');break; @@ -260,15 +256,16 @@ class MainController extends Controller 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; + case 1: $houses = $houses->orderByDesc('area');break; + case 2: $houses = $houses->orderBy('area');break; } + } else { $houses = $houses->orderBy('price')-> orderByDesc('created_at')-> orderByDesc('area'); } -*/ + $houses = $houses->paginate(4); if ($request->ajax()) { diff --git a/resources/views/ajax/complex/category.blade.php b/resources/views/ajax/complex/category.blade.php index 240ef0a..14df5fd 100644 --- a/resources/views/ajax/complex/category.blade.php +++ b/resources/views/ajax/complex/category.blade.php @@ -9,6 +9,6 @@ @endif
+ ++-------------------- diff --git a/resources/views/catalog.blade.php b/resources/views/catalog.blade.php index 782766d..5f2f740 100644 --- a/resources/views/catalog.blade.php +++ b/resources/views/catalog.blade.php @@ -5,8 +5,10 @@ @endsection @section('custom_js') + @include('js.filter_value'); diff --git a/resources/views/part/filter/catalog.blade.php b/resources/views/part/filter/catalog.blade.php index 84e415d..dde08b9 100644 --- a/resources/views/part/filter/catalog.blade.php +++ b/resources/views/part/filter/catalog.blade.php @@ -103,7 +103,7 @@ diff --git a/resources/views/part/filter/main.blade.php b/resources/views/part/filter/main.blade.php index accf867..aa15aaf 100644 --- a/resources/views/part/filter/main.blade.php +++ b/resources/views/part/filter/main.blade.php @@ -97,7 +97,7 @@