home page mobile changed

This commit is contained in:
merdan 2020-03-28 15:26:16 +05:00
parent 77de064069
commit dcb0c75d45
2 changed files with 4 additions and 3 deletions

View File

@ -58,8 +58,7 @@ class PublicController extends Controller
$query->onLive($data['start'], $data['end']); $query->onLive($data['start'], $data['end']);
}) })
->with(['cat_events' => function($q) use($data,$order){ ->with(['cat_events' => function($q) use($data,$order){
$q->onLive($data['start'], $data['end']) $q->onLive($data['start'], $data['end'],8)
->take(20)
->orderBy($order['field'],$order['order']); ->orderBy($order['field'],$order['order']);
}]); }]);
// $query->withLiveEvents($order, $data['start'], $data['end']); // $query->withLiveEvents($order, $data['start'], $data['end']);

View File

@ -490,7 +490,7 @@ ICSTemplate;
return (is_null($this->access_codes()->where('id', $accessCodeId)->first()) === false); 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 //if date is null carbon creates now date instance
//todo what if only end date is null?? //todo what if only end date is null??
if(!empty($start_date) && !empty($end_date)) if(!empty($start_date) && !empty($end_date))
@ -500,6 +500,8 @@ ICSTemplate;
} }
else else
$query->where('end_date','>',Carbon::now(config('app.timezone'))); $query->where('end_date','>',Carbon::now(config('app.timezone')));
if($limit)
$query->take($limit);
return $query->where('is_live',1) return $query->where('is_live',1)
->withCount(['images as image_url' => function($q){ ->withCount(['images as image_url' => function($q){