entity = $entity; $this->contact_id = $contact_id; $this->signature = $signature; $this->ip = $ip; } /** * Execute the job. * * @return void */ public function handle() { $invitation = false; if($this->entity instanceof PurchaseOrder){ $invitation = $this->entity->invitations()->where('vendor_contact_id', $this->contact_id)->first(); if(!$invitation) $invitation = $this->entity->invitations->first(); } else { $invitation = $this->entity->invitations()->where('client_contact_id', $this->contact_id)->first(); if(!$invitation) $invitation = $this->entity->invitations->first(); } if (! $invitation) { return; } $invitation->signature_base64 = $this->signature; $invitation->signature_date = now(); $invitation->signature_ip = $this->ip; $invitation->save(); } }