You can also do:
$booking->attach($n);
But for this example in specific I think you're doing it the more organized way. It works clearer when it is a many-to-many relationship (and this one looks like it is) so when you use the attach() function it creates the entry for you in the relationship table
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community