Skip to content
Discussion options

You must be logged in to vote

In case anyone has this challenge in the future, Here is how I got my data saving and pulling from the pivot table.

In my Employee edit screen file I needed to add the following to the createOrUpdate method after the initial save:

$employee->locations($employee->id)->sync(optional($request->get('employee'))['locations']);

In the same file where I define my form fields I used:

Relation::make('employee.locations.')
                        ->fromModel(Branch::class, 'name')
                        ->multiple()
                        ->title('Assign to Location(s)')
                        ->help('Assign to one or more location.'),

In the same file in my query method I added the following b…

Replies: 4 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by willardinteractive
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@LemonPie22
Comment options

@Estigy
Comment options

@LemonPie22
Comment options

@LemonPie22
Comment options

@LemonPie22
Comment options

Comment options

You must be logged in to vote
4 replies
@LemonPie22
Comment options

@Estigy
Comment options

@Estigy
Comment options

@LemonPie22
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants