@extends(get_view('template-main'), [ 'title' => 'Купить '.$mark->name.' : комплектации и цены в автосалоне' ]) @section('content')
@include(get_view('main-marks'))
@include(get_view('filter-form'))
@php $markId = $mark->id; $bodies = \JustWeCMS\Modules\Auto\Entities\Body::filter()->where('active', 1)->whereHas('model', function($query) use($markId) { $query->where('mark_id', $markId); })->orderBy('position')->get(); @endphp @php $maxDiscount = 0; $bodies->each(function($item, $key) use(&$maxDiscount) { $discount = $item->getMinPrice('price_old') - $item->getMinPrice(); if($discount > $maxDiscount) { $maxDiscount = $discount; } }); @endphp
Новые автомобили {{ $mark->name }}
@php $bodies = \JustWeCMS\Modules\Auto\Entities\Body::where('active',1)->whereHas('model', function($query) use($markId) {$query->where('mark_id', $markId);})->orderBy('position'); //Если перешли со страницы коммерческого транспорта, то показываем только модели, в которых есть коммерческий транспорт if( ($from = request()->get('from', null)) === 'COMMERCIAL' ) { $bodies->where('type_of_car', 'COMMERCIAL'); } $bodies = $bodies->get(); @endphp @if(count($bodies)) @endif
@include(get_view('main-form-2')) @endsection