event_id = $event_id; $this->entity = $entity; $this->company = $company; $this->includes = $includes; } /** * Execute the job. * * @return bool */ public function handle() { MultiDB::setDb($this->company->db); //If the company is disabled, or if on hosted, the user is not a paid hosted user return early if (! $this->company || $this->company->is_disabled || (Ninja::isHosted() && !$this->company->account->isPaidHostedClient())) { return true; } $subscriptions = Webhook::where('company_id', $this->company->id) ->where('event_id', $this->event_id) ->cursor() ->each(function ($subscription) { WebhookSingle::dispatch($subscription->id, $this->entity, $this->company->db, $this->includes); }); } public function failed($exception = null) { if($exception) nlog(print_r($exception->getMessage(), 1)); } }