Support the ongoing development of Laravel.io →
Eloquent
Last updated 1 year ago.
0

You have company_id, address_id and number. Just delete the record manually from the pivot (not with detach). You don't have to use eloquent for everything, and in this case it would be probably cause more code then query builder.

0

I was already thinking about it, but I thought I was missing just some detach information to work, but I have not yet found a solution on the internet. The best should be to not even use the detach.

It will be the first time I will use Query Builder in Laravel. I thought about creating a Model CompanyAddress and remove with delete ().

0

Maybe there is an elegant solution with eloquent, you can try this...

$company->addresses()->wherePivot('order',$order)->detach($address_id)
Last updated 5 years ago.
0

Thank you, it worked the way you wanted it.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.