Don't you know how to do an ajax lookup / response? Auto filling one or more fields Using ajax is ajax 101. Use jquery ajax.
i'm referring purely to updating a data array to the lookup table, not the front end.
before
book_id, language_id
1, 1
1, 2
after
book_id, language_id
1, 2
1, 3
1, 4
one row is deleted (1,1), one remains the same (1,2), two rows are added. I'm asking if Eloquent will do that automatically somehow
@jmp909, you are looking for sync()
method:
$book->languages()->sync( $array_of_language_ids );
See Inserting related models section of docs on Eloquent.
great thanks. I did see that somewhere but wasn't quite sure if it was what I needed
will try it out
regards J
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community