mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-17 16:40:31 +00:00
🔄 Replace ilike/like with whereLike and orWhereLike across views and remove macros for cleaner, driver-agnostic querying
This commit is contained in:
@@ -26,7 +26,7 @@ class extends Component {
|
||||
'cities' => City::query()
|
||||
->with(['country', 'createdBy'])
|
||||
->when($this->search, fn($query)
|
||||
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
|
||||
=> $query->whereLike('name', '%'.$this->search.'%'),
|
||||
)
|
||||
->whereHas('country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->orderBy('name')
|
||||
|
||||
@@ -29,8 +29,8 @@ class extends Component {
|
||||
])
|
||||
->when($this->search, fn($query)
|
||||
=> $query
|
||||
->where('name', 'ilike', '%'.$this->search.'%')
|
||||
->orWhere('description', 'ilike', '%'.$this->search.'%'),
|
||||
->whereLike('name', '%'.$this->search.'%')
|
||||
->orWhereLike('description', '%'.$this->search.'%'),
|
||||
)
|
||||
->whereHas('courseEvents.venue.city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->orderByDesc('has_future_events')
|
||||
|
||||
@@ -40,9 +40,9 @@ class extends Component {
|
||||
fn($query) => $query->where('countries.code', $this->country))
|
||||
->when($this->search, fn($query)
|
||||
=> $query
|
||||
->where('name', 'ilike', '%'.$this->search.'%')
|
||||
->orWhere('description', 'ilike', '%'.$this->search.'%')
|
||||
->orWhere('subtitle', 'ilike', '%'.$this->search.'%'),
|
||||
->whereLike('name', '%'.$this->search.'%')
|
||||
->orWhereLike('description', '%'.$this->search.'%')
|
||||
->orWhereLike('subtitle', '%'.$this->search.'%'),
|
||||
)
|
||||
->orderByDesc('has_future_events')
|
||||
->orderBy('name', 'asc')
|
||||
|
||||
@@ -40,7 +40,7 @@ class extends Component {
|
||||
$query->whereHas('city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
)
|
||||
->when($this->search, fn($query)
|
||||
=> $query->where('meetups.name', 'ilike', '%'.$this->search.'%'),
|
||||
=> $query->whereLike('meetups.name', '%'.$this->search.'%'),
|
||||
)
|
||||
->orderByDesc('has_future_events')
|
||||
->orderByRaw('next_event_start ASC NULLS LAST')
|
||||
|
||||
@@ -32,7 +32,7 @@ class extends Component {
|
||||
return [
|
||||
'services' => SelfHostedService::query()
|
||||
->with('createdBy')
|
||||
->when($this->search, fn($q) => $q->where('name', 'ilike', '%'.$this->search.'%'))
|
||||
->when($this->search, fn($q) => $q->whereLike('name', '%'.$this->search.'%'))
|
||||
->when($this->typeFilter, fn($q) => $q->where('type', $this->typeFilter))
|
||||
->orderBy('name')
|
||||
->paginate(15),
|
||||
|
||||
@@ -25,7 +25,7 @@ class extends Component {
|
||||
return [
|
||||
'venues' => Venue::with(['city.country', 'createdBy'])
|
||||
->when($this->search, fn($query)
|
||||
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
|
||||
=> $query->whereLike('name', '%'.$this->search.'%'),
|
||||
)
|
||||
->whereHas('city.country', fn($query) => $query->where('countries.code', $this->country))
|
||||
->orderBy('name')
|
||||
|
||||
Reference in New Issue
Block a user