-
app/Http/Controllers/SpeakingController.php
Open in GitHubuse App\Models\Talk; use App\Models\Video; class SpeakingController { public function __invoke() { $talks = Talk::orderBy('presented_at', 'desc') ->get() ->groupBy('title'); $videos = Video::latest()->get(); return view('front.speaking.index', compact('talks', 'videos')); } }
-
resources/views/front/speaking/index.blade.php
Open in GitHub// @foreach($talks as $title => $talks) @include('front.speaking.partials.talk') @endforeach </x-app-layout>
-
resources/views/front/speaking/partials/talk.blade.php
Open in GitHub<article class="mt-6"> <h2 class="font-semibold leading-tight mb-1"> {{ $title }} </h2> <ul class="leading-relaxed"> @foreach ($talks as $talk) <li class="text-sm text-gray-700"> {{ $talk->location }} on <time datetime="{{ optional($talk->presented_at)->format(DateTime::ATOM) }}"> {{ $talk->presented_at->format('M jS Y') }} </time> @if($talk->video_link) – <a class="underline" href="{{ $talk->video_link }}"> Video</a> @endif @if($talk->slides_link) – <a class="underline" href="{{ $talk->slides_link }}"> Slides</a> @endif @if($talk->joindin_link) – <a class="underline" href="{{ $talk->joindin_link }}"> Joind.in</a> @endif </li> @endforeach </ul> </article>