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); // } })->latest()->paginate(10)->withQueryString(); } public function pluck(callable $query = null) { $baseQuery = CostCalculator::query(); if (is_callable($query)) { $query($baseQuery); } return $baseQuery->pluck('title', 'id'); } }