I have been looking around for ways to delete some rows from joined tables in Laravel 5.7. I have three tables(Inventories, Vehicles and Vimages) and I want to join them all together and delete the rows together. Does anyone know if this is possible?
The reason I am trying to do this is because the Vehicles and Inventories table have a one to one relationship, which only the Inventories table has an id which is used to sort the vehicles(Dealer Id). So I can select multiple vehicles from Inventories with the dealer id and delete them but I cannot do the same with the Vehicles table.
Thanks
My Join:
- Inventory::leftJoin(
- 'vehicles', 'vehicles.id', '=', 'inventories.vehicle_id'
- )->leftJoin(
- 'vimages', 'vimages.inventory_id', '=', 'inventories.id'
- )->where(
- 'inventories.dealer_id', '=', \Auth::user()->dealer_id