contact) { $this->contact = $this->invoice->client->primary_contact()->first() ?: $this->invoice->client->contacts()->first(); } $invitation = $this->invoice->invitations->where('client_contact_id', $this->contact->id)->first(); if (! $invitation) { $invitation = $this->invoice->invitations->first(); } $file_path = $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()). $this->invoice->getFileName("xml"); // $disk = 'public'; $disk = config('filesystems.default'); $file = Storage::disk($disk)->exists($file_path); if (! $file) { $file_path = (new CreateXInvoice($this->invoice, false))->handle(); } return $file_path; } }