invitation = $invitation; $this->entity = $invitation->purchase_order; $this->contact = $invitation->contact; $this->vendor = $invitation->contact->vendor; $this->disk = $disk ?? config('filesystems.default'); } public function handle() { MultiDB::setDb($this->invitation->company->db); $file_path = $this->vendor->purchase_order_filepath($this->invitation); $pdf = (new PdfService($this->invitation, 'purchase_order'))->getPdf(); if ($pdf) { try { Storage::disk($this->disk)->put($file_path, $pdf); } catch (\Exception $e) { throw new FilePermissionsFailure($e->getMessage()); } } return $pdf; } public function failed($e) { } }