entity = $entity; $this->contact = $contact; } public function run() { if (! $this->contact) { $this->contact = $this->entity->client->primary_contact()->first(); } $invitation = $this->entity->invitations->where('client_contact_id', $this->contact->id)->first(); $path = $this->entity->client->recurring_invoice_filepath(); $file_path = $path.$this->entity->hashed_id.'.pdf'; $disk = 'public'; $file = Storage::disk($disk)->exists($file_path); if (! $file) { $file_path = CreateEntityPdf::dispatchNow($invitation); } return Storage::disk($disk)->path($file_path); } }