invitation = $invitation; $this->credit = $invitation->credit; $this->company = $invitation->company; $this->contact = $invitation->contact; $this->disk = $disk ?? config('filesystems.default'); } public function handle() { if(config('ninja.phantomjs_key')) return (new Phantom)->generate($this->invitation); $this->credit->load('client'); App::setLocale($this->contact->preferredLocale()); $path = $this->credit->client->credit_filepath(); $file_path = $path . $this->credit->number . '.pdf'; $credit_design_id = $this->credit->design_id ? $this->credit->design_id : $this->decodePrimaryKey($this->credit->client->getSetting('credit_design_id')); $design = Design::find($credit_design_id); $designer = new Designer($this->credit, $design, $this->credit->client->getSetting('pdf_variables'), 'credit'); $html = (new HtmlEngine($designer, $this->invitation, 'credit'))->build(); Storage::makeDirectory($path, 0775); $pdf = $this->makePdf(null, null, $html); $instance = Storage::disk($this->disk)->put($file_path, $pdf); return $file_path; } }