country = request()->route('country'); } public function with(): array { return [ 'lecturers' => Lecturer::with([ 'createdBy', 'coursesEvents' => fn($query) => $query->where('from', '>=', now())->orderBy('from', 'asc') ]) ->withExists([ 'coursesEvents as has_future_events' => fn($query) => $query->where('from', '>=', now()) ]) ->withCount([ 'coursesEvents as future_events_count' => fn($query) => $query->where('from', '>=', now()) ]) ->when($this->search, fn($query) => $query ->where('name', 'ilike', '%'.$this->search.'%') ->orWhere('description', 'ilike', '%'.$this->search.'%') ->orWhere('subtitle', 'ilike', '%'.$this->search.'%'), ) ->orderByDesc('has_future_events') ->orderBy('name', 'asc') ->paginate(15), ]; } }; ?>
{{ __('Dozenten') }}
@auth {{ __('Dozenten anlegen') }} @endauth
{{ __('Name') }} {{ __('Nächster Termin') }} {{ __('Kurse') }} {{ __('Links') }} {{ __('Aktionen') }} @foreach ($lecturers as $lecturer)
{{ $lecturer->name }}
@if($lecturer->active) {{ __('Aktiv') }} @else {{ __('Inaktiv') }} @endif
@php $nextEvent = $lecturer->coursesEvents->first(); @endphp @if($nextEvent)
{{ $nextEvent->from->format('d.m.Y H:i') }} @if($lecturer->future_events_count > 1)
+{{ $lecturer->future_events_count - 1 }} {{ __('weitere Termine') }}
@endif
@endif
{{ $lecturer->courses()->count() }} {{ __('Kurse') }}
@if($lecturer->website) @endif @if($lecturer->twitter_username) @endif @if($lecturer->nostr) @endif
{{ __('Bearbeiten') }}
@endforeach