mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-20 13:40:15 +00:00
🌍 Scope cities, venues, and courses by country across views and refine sidebar counts accordingly
This commit is contained in:
@@ -23,10 +23,12 @@ class extends Component {
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'cities' => City::with(['country', 'createdBy'])
|
||||
'cities' => City::query()
|
||||
->with(['country', 'createdBy'])
|
||||
->when($this->search, fn($query)
|
||||
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
|
||||
)
|
||||
->whereHas('country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->orderBy('name')
|
||||
->paginate(15),
|
||||
];
|
||||
|
||||
@@ -32,7 +32,7 @@ class extends Component {
|
||||
->where('name', 'ilike', '%'.$this->search.'%')
|
||||
->orWhere('description', 'ilike', '%'.$this->search.'%'),
|
||||
)
|
||||
->whereHas('courseEvents.venue.city.country', fn($query) => $query->where('countries.code', request()->route('country')))
|
||||
->whereHas('courseEvents.venue.city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->orderByDesc('has_future_events')
|
||||
->paginate(15),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user