lazycoder
lazycoder
TLCTuto's Laravel Corner
Created by lazycoder on 1/13/2025 in #🚀laravel
Laravel Learning Management System
WatchEpisode.php <?php namespace App\Livewire; use App\Models\Course; use App\Models\Episode; use Filament\Forms\Concerns\InteractsWithForms; use Filament\Forms\Contracts\HasForms; use Filament\Infolists\Concerns\InteractsWithInfolists; use Filament\Infolists\Contracts\HasInfolists; use Filament\Infolists\Infolist; use Filament\Infolists; use Livewire\Component; class WatchEpisode extends Component implements HasInfolists, HasForms { use InteractsWithInfolists, InteractsWithForms; public Course $course; public Episode $currentEpisode; public function mount(Course $course, ?Episode $episode = null) { $this->course = $course; $this->currentEpisode = isset($episode->id) ? $episode : $course->episodes->first(); } public function episodeInfolist(Infolist $infolist): Infolist { return $infolist ->record($this->currentEpisode) ->schema([ \App\Infolists\Components\VideoPlayerEntry::make('vimeo_id') ->hiddenLabel(), Infolists\Components\TextEntry::make('overview') ->label('Overview'), Infolists\Components\RepeatableEntry::make('course.episodes') ->schema([ Infolists\Components\TextEntry::make('title') ->label('') ->icon('heroicon-o-play-circle'), Infolists\Components\TextEntry::make('formatted_duration') ->label('') ->icon('heroicon-o-clock'), ]), ]); } public function render() { return view('livewire.watch-episode'); } }
5 replies
TLCTuto's Laravel Corner
Created by lazycoder on 1/13/2025 in #🚀laravel
Laravel Learning Management System
web.php Route::get('/courses/{course}/episodes/{episode?}', WatchEpisode::class)->name('courses.episodes.show');
5 replies