author_id = Auth::id(); } 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(), ]; } public function create() { $course = Course::create( array_merge($this->form->getState(), ['user_id' => $this->author_id]) ); return redirect()->route('course-edit', ['course' => $course]); } public function render() { return view('livewire.course.course-create')->layout('layouts.base'); } }