lesson = $this->course->getLesson($lesson); $this->form->fill([ 'name' => $this->lesson->name, 'slug' => $this->lesson->slug, 'body' => $this->lesson->body ]); } protected function getFormSchema(): array { return [ TextInput::make('name') ->label('Название занятия') ->required() ->reactive() ->afterStateUpdated(function (Closure $set, $state) { $set('slug', Str::slug($state)); }), TextInput::make('slug') ->label('Название в url-ссылке') ->required(), MarkdownEditor::make('body') ]; } public function update() { $this->lesson->updateOrFail($this->form->getState()); return redirect()->route('course-edit', ['course' => $this->course]); } public function render() { return view('livewire.lesson.lesson-edit')->layout('layouts.base'); } }