credit = $credit; $this->company = $company; $this->contact = $contact; $this->disk = $disk ?? config('filesystems.default'); } public function handle() { MultiDB::setDB($this->company->db); $this->credit->load('client'); if (!$this->contact) { $this->contact = $this->credit->client->primary_contact()->first(); } App::setLocale($this->contact->preferredLocale()); $path = $this->credit->client->credit_filepath(); $file_path = $path . $this->credit->number . '.pdf'; $design = Design::find($this->decodePrimaryKey($this->credit->client->getSetting('credit_design_id'))); $designer = new Designer($this->credit, $design, $this->credit->client->getSetting('pdf_variables'), 'credit'); //get invoice design // $html = $this->generateInvoiceHtml($designer->build()->getHtml(), $this->credit, $this->contact); $html = $this->generateEntityHtml($designer, $this->credit, $this->contact); //todo - move this to the client creation stage so we don't keep hitting this unnecessarily Storage::makeDirectory($path, 0755); //\Log::error($html); $pdf = $this->makePdf(null, null, $html); $instance = Storage::disk($this->disk)->put($file_path, $pdf); //$instance= Storage::disk($this->disk)->path($file_path); // return $file_path; } }