courseId = $courseId; } public function getCourse(): Course { return Course::findOrFail($this->courseId); } public function getSessions(): Collection { return $this->getCourse()->classSessions()->orderBy('session_number', 'asc')->get(); } public function getTitle(): string { return 'Sesi Kelas - '.$this->getCourse()->name; } protected function getHeaderActions(): array { return [ CreateAction::make() ->label('Tambah Sesi') ->modalHeading('Tambah Sesi') ->modalSubmitActionLabel('Simpan') ->modalCancelActionLabel('Batal') ->mutateFormDataUsing(function (array $data): array { $data['course_id'] = $this->courseId; return $data; }) ->extraModalFooterActions(fn (CreateAction $action): array => [ $action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) ->label('Simpan dan Tambah Lagi'), ]) ->modalWidth(Width::TwoExtraLarge), ]; } public function editSessionAction(): Action { return EditAction::make('editSession') ->record(fn (array $arguments) => ClassSession::find($arguments['session'])) ->modalWidth(Width::TwoExtraLarge); } public function deleteSessionAction(): Action { return DeleteAction::make('deleteSession') ->record(fn (array $arguments) => ClassSession::find($arguments['session'])); } }