filled('country_id')) { $query->where('country_id', $request->country_id); } if ($request->filled('stay_type_id')) { $query->where("stay_type_id", $request->stay_type_id); } if ($request->filled('program_id')) { Program::where('status', 1)-> where('id', $request->program_id)->get(); } })->latest()->paginate(10)->withQueryString(); } public function pluck(callable $query = null) { $baseQuery = CostCalculator::query(); if (is_callable($query)) { $query($baseQuery); } return $baseQuery->pluck('title', 'id'); } }