notification::getType(); $payloads = $this->notification->getPayloads(); /** @var WebHook[] $targets */ $targets = WebHook::find() // It's very important to use exactly single quote to begin the string // and double quote to specify the string value ->andWhere(new Expression("JSON_CONTAINS(`events`, '\"{$type}\"')")) ->all(); foreach ($targets as $target) { $job = new DeliveryWebHook(); $job->type = $type; $job->url = $target->url; $job->secret = $target->secret; $job->payloads = $payloads; $queue->push($job); } } }