country = request()->route('country', config('app.domain_country'));
}
public function with(): array
{
return [
'venues' => Venue::with(['city.country', 'createdBy'])
->when($this->search, fn($query)
=> $query->where('name', 'ilike', '%'.$this->search.'%'),
)
->whereHas('city.country', fn($query) => $query->where('countries.code', $this->country))
->orderBy('name')
->paginate(15),
];
}
}; ?>
{{ __('Venues') }}
@auth
{{ __('Create Venue') }}
@endauth
{{ __('Name') }}
{{ __('City') }}
{{ __('Created By') }}
{{ __('Actions') }}
@foreach ($venues as $venue)
{{ $venue->name }}
@if($venue->city)
{{ $venue->city->name }}
@if($venue->city->country)
({{ $venue->city->country->name }})
@endif
@endif
@if($venue->createdBy)
{{ Str::limit($venue->createdBy->name, 30) }}
@endif
@if(auth()->check())
{{ __('Edit') }}
@elseif(!auth()->check())
{{ __('Log in') }}
@endif
@endforeach