option('marking'))->first(); $company_module_id = $connection->invitee->id; $orders = Order::where('company_module_id', $company_module_id)->get(); foreach ($orders as $order){ $invoices = $order->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get(); foreach ($invoices as $invoice){ dump($invoice->id); // $invoice->documents()->delete(); $invoice->documents()->where('document_type', DocumentType::SHIPPING_EINVOICE)->delete(); (App()->make(CreateShippingInvoiceTransactionDocProcessor::class))->execute($invoice); } } } }