From dcb0c75d45648465eed63c0c87853278ba27889a Mon Sep 17 00:00:00 2001 From: merdan Date: Sat, 28 Mar 2020 15:26:16 +0500 Subject: [PATCH] home page mobile changed --- app/Http/Controllers/PublicController.php | 3 +-- app/Models/Event.php | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php index fd7f42c5..91a2db10 100644 --- a/app/Http/Controllers/PublicController.php +++ b/app/Http/Controllers/PublicController.php @@ -58,8 +58,7 @@ class PublicController extends Controller $query->onLive($data['start'], $data['end']); }) ->with(['cat_events' => function($q) use($data,$order){ - $q->onLive($data['start'], $data['end']) - ->take(20) + $q->onLive($data['start'], $data['end'],8) ->orderBy($order['field'],$order['order']); }]); // $query->withLiveEvents($order, $data['start'], $data['end']); diff --git a/app/Models/Event.php b/app/Models/Event.php index b2d68051..f3c2f589 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -490,7 +490,7 @@ ICSTemplate; return (is_null($this->access_codes()->where('id', $accessCodeId)->first()) === false); } - public function scopeOnLive($query, $start_date = null, $end_date = null){ + public function scopeOnLive($query, $start_date = null, $end_date = null,$limit = false){ //if date is null carbon creates now date instance //todo what if only end date is null?? if(!empty($start_date) && !empty($end_date)) @@ -500,6 +500,8 @@ ICSTemplate; } else $query->where('end_date','>',Carbon::now(config('app.timezone'))); + if($limit) + $query->take($limit); return $query->where('is_live',1) ->withCount(['images as image_url' => function($q){