home page desktop changed

This commit is contained in:
merdan 2020-03-28 14:00:22 +05:00
parent 718d526818
commit e069e0930c
7 changed files with 43 additions and 42 deletions

View File

@ -24,28 +24,23 @@ use Illuminate\Support\Facades\DB;
class PublicController extends Controller
{
public function showHomePage(){
$cinema = Category::where('view_type','cinema')
->categoryLiveEvents(16)
$cinema = Category::categoryLiveEvents(16,'cinema')
->take(1);
$cartoon = Category::where('view_type','exhibition')//todo change to cartoon multik
->categoryLiveEvents(16)
$cartoon = Category::categoryLiveEvents(16,'cartoon')
->take(1);
$musical = Category::where('view_type','concert')
->categoryLiveEvents(8)
$musical = Category::categoryLiveEvents(8,'concert')
->take(1)
;
$all = $cinema->unionAll($cartoon)->unionAll($musical)->get();
dd($all->where('view_type','cinema'));
$categories = $cinema->unionAll($cartoon)->unionAll($musical)->get();
$sliders = Slider::where('active',1)
->where(Config::get('app.locale'),1)
->get();
return $this->render("Pages.HomePage",[
'all' => $all,
'categories' => $categories,
'sliders' => $sliders
]);

View File

@ -86,9 +86,10 @@ class Category extends \Illuminate\Database\Eloquent\Model{
}]);
}
public function scopeCategoryLiveEvents($query,$limit){
public function scopeCategoryLiveEvents($query,$limit,$view){
// dd($this->view_type);
return $query->select('id','title_tk','title_ru','lft')
return $query->select('id','title_tk','title_ru','view_type')
->where('view_type',$view)
->orderBy('lft')
->with(['events' => function($q) use($limit){
$q->select('id','title_'.Config::get('app.locale'),'description_'.Config::get('app.locale'),'category_id','sub_category_id','start_date')

View File

@ -9,36 +9,10 @@
@include('desktop.Partials.HomeSlider')
@if(isset($cinema))
@include('desktop.Partials.HomeCinema',['category'=>$cinema,'id'=>'kinoteator'])
@endif
@foreach($categories as $category)
@include("desktop.Partials.{$category->view_type}",['category'=>$category])
@endforeach
@if(isset($musical))
@include('desktop.Partials.HomeMusical')
@endif
{{--<section id="first-add-wrapper" style="margin: 100px 0;">--}}
{{-- <div class="container">--}}
{{-- <div class="row" style="padding: 0 20px;">--}}
{{-- <a href="" style="width: 100%">--}}
{{-- <img src="{{asset('assets/images/advs/first.png')}}" style="width: 100%">--}}
{{-- </a>--}}
{{-- </div>--}}
{{-- </div>--}}
{{--</section>--}}
@if(isset($cartoon))
@include('desktop.Partials.HomeCinema',['category'=>$cartoon,'id'=>'cartoon'])
@endif
{{--<section id="second-add-wrapper" style="margin: 100px 0;">--}}
{{-- <div class="container">--}}
{{-- <div class="row" style="padding: 0 20px;">--}}
{{-- <a href="" style="width: 100%">--}}
{{-- <img src="{{asset('assets/images/advs/second.png')}}" style="width: 100%">--}}
{{-- </a>--}}
{{-- </div>--}}
{{-- </div>--}}
{{--</section>--}}
@endsection
@section('after_scripts')
<script src="{{asset('vendor/jquery-migrate/jquery-migrate.min.js')}}"></script>
<!-- JS Implementing Plugins -->

View File

@ -1,5 +1,5 @@
@if(!empty($category->events) && $category->events->count()>0)
<section id="{{$id}}" class="kinoteator-section waaa container mb-5">
<section id="cartoon" class="kinoteator-section waaa container mb-5">
<div class="tab-header d-flex justify-content-between col-12 px-0">
<h2 class="">{{$category->title}}</h2>
<div style="height: 5px; position: absolute; bottom: 0; width: 100px; background-color: rgba(211,61,51,1)"></div>

View File

@ -0,0 +1,31 @@
@if(!empty($category->events) && $category->events->count()>0)
<section id="kinoteator" class="kinoteator-section waaa container mb-5">
<div class="tab-header d-flex justify-content-between col-12 px-0">
<h2 class="">{{$category->title}}</h2>
<div style="height: 5px; position: absolute; bottom: 0; width: 100px; background-color: rgba(211,61,51,1)"></div>
<a class="" href="{{$category->url}}">{{__('ClientSide.view')}}</a>
</div>
<div class="tab-ozi col-12 px-0 mt-5">
<div class="owl-carousel" id="{{$id}}-tab1">
<div class="row">
@foreach($category->events->slice(0,8) as $event)
<div class="col-3 pb-4">
@include('desktop.Partials.CinemaItem',['event'=>$event])
</div>
@endforeach
</div>
@if($category->count()>8)
<div class="row">
@foreach($category->events->slice(8) as $event)
<div class="col-3 pb-4">
@include('desktop.Partials.CinemaItem',['event'=>$event])
</div>
@endforeach
</div>
@endif
</div>
</div>
</section>
@endif