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.
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 ().
Maybe there is an elegant solution with eloquent, you can try this...
$company->addresses()->wherePivot('order',$order)->detach($address_id)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community