Create relationship data from Parent from Create Page.

Greetings! Need help figuring out how I can store data to the relation table from the parent.

I have :

Event hasOne EventCourse
EventCourse belongsToMany Profile

I wanted to create a Wizard form with steps: basic and course.

I searched around in the docs but I'm having trouble finding the proper page where I can read about this.

I tried doing below:

            Step::make('Course Details')
                ->description('Describe the kind of course and experience participants can expect when they take part in your event.')
                ->schema([
                                       Select::make('course.profiles')
                        ->label('Course Profile')
                        ->relationship('course.profiles')
                        ->options(\App\Models\CourseProfile::pluck('name', 'id'))
                        ->native(false)
                        ->multiple(),


Can any one guide me to the right direction?
Solution
Solved!

Turns out I had to use Group

                    Group::make()
                        ->relationship('course')
                        ->schema([
                            Grid::make(12)
                                ->schema([
                                    Select::make('profiles')
                                        ->relationship('profiles', 'name')
                                        ->preload()
                                        ->multiple()
                                        ->maxItems(1)
                                        ->columnSpan(6)
                                        ->native(false),


if someone sees this can someone verify that if Iam doing the right thing or not.

OR if there's a better way to do this then please teach me.
Was this page helpful?