mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-13 23:56:47 +00:00
🌍 Scope cities, venues, and courses by country across views and refine sidebar counts accordingly
This commit is contained in:
@@ -93,13 +93,13 @@
|
|||||||
<flux:navlist.item icon="building-office-2" :href="route_with_country('cities.index')"
|
<flux:navlist.item icon="building-office-2" :href="route_with_country('cities.index')"
|
||||||
:current="request()->routeIs('cities.index')"
|
:current="request()->routeIs('cities.index')"
|
||||||
wire:navigate
|
wire:navigate
|
||||||
badge="{{ \App\Models\City::query()->count() }}">
|
badge="{{ \App\Models\City::query()->whereHas('country', fn($query) => $query->where('countries.code', request()->route('country')))->count() }}">
|
||||||
{{ __('Städte/Gebiete') }}
|
{{ __('Städte/Gebiete') }}
|
||||||
</flux:navlist.item>
|
</flux:navlist.item>
|
||||||
<flux:navlist.item icon="map-pin" :href="route_with_country('venues.index')"
|
<flux:navlist.item icon="map-pin" :href="route_with_country('venues.index')"
|
||||||
:current="request()->routeIs('venues.index')"
|
:current="request()->routeIs('venues.index')"
|
||||||
wire:navigate
|
wire:navigate
|
||||||
badge="{{ \App\Models\Venue::query()->count() }}">
|
badge="{{ \App\Models\Venue::query()->whereHas('city.country', fn($query) => $query->where('countries.code', request()->route('country')))->count() }}">
|
||||||
{{ __('Veranstaltungsorte') }}
|
{{ __('Veranstaltungsorte') }}
|
||||||
</flux:navlist.item>
|
</flux:navlist.item>
|
||||||
</flux:navlist.group>
|
</flux:navlist.group>
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ class extends Component {
|
|||||||
public function with(): array
|
public function with(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'cities' => City::with(['country', 'createdBy'])
|
'cities' => City::query()
|
||||||
|
->with(['country', 'createdBy'])
|
||||||
->when($this->search, fn($query)
|
->when($this->search, fn($query)
|
||||||
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
|
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
|
||||||
)
|
)
|
||||||
|
->whereHas('country', fn($query) => $query->where('countries.code', $this->country))
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->paginate(15),
|
->paginate(15),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class extends Component {
|
|||||||
->where('name', 'ilike', '%'.$this->search.'%')
|
->where('name', 'ilike', '%'.$this->search.'%')
|
||||||
->orWhere('description', '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')
|
->orderByDesc('has_future_events')
|
||||||
->paginate(15),
|
->paginate(15),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user