model = $model; } public function byPositionIdGetActive($position, $area_id) { $now = Carbon::now()->toDateTimeString(); $area_ids = array_unique([0, $area_id]); return $this->model->whereIn('area_id', $area_ids)->whereIn('advertisement_position_slug', $position)->where('start_time', '<=', $now)->where('end_time', '>', $now)->where('is_display', Advertisement::DISPLAY_OK)->orderBy('sort', 'desc')->get(); } }