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($invitation); $file_path = $path.$this->entity->hashed_id.'.pdf'; $disk = config('filesystems.default'); $file = Storage::disk($disk)->exists($file_path); if (! $file) { $file_path = (new CreateEntityPdf($invitation))->handle(); } return $file_path; } }