->when($this->country

This commit is contained in:
Benjamin Takats
2023-01-19 12:40:19 +01:00
parent 8ef4f018d0
commit d125c5d847

View File

@@ -69,13 +69,13 @@ class MeetupTable extends DataTableComponent
public function builder(): Builder
{
return Meetup::query()
->when($this->country, fn($query, $country) => $query->whereHas('city.country',
fn($query) => $query->where('code', $this->country)))
->with([
'users',
'city.country',
'meetupEvents',
])
->when($this->country, fn($query, $country) => $query->whereHas('city.country',
fn($query) => $query->where('code', $this->country)))
->withCount([
'users',
'meetupEvents' => fn($query) => $query->where('start', '>=', now()),