App\Listeners\SubscriptionListener::checkSubscriptions PHP Method

checkSubscriptions() private method

private checkSubscriptions ( $eventId, $entity, $transformer, string $include = '' )
$eventId
$entity
$transformer
$include string
    private function checkSubscriptions($eventId, $entity, $transformer, $include = '')
    {
        if (!EntityModel::$notifySubscriptions) {
            return;
        }
        $subscription = $entity->account->getSubscription($eventId);
        if ($subscription) {
            $manager = new Manager();
            $manager->setSerializer(new ArraySerializer());
            $manager->parseIncludes($include);
            $resource = new Item($entity, $transformer, $entity->getEntityType());
            $data = $manager->createData($resource)->toArray();
            // For legacy Zapier support
            if (isset($data['client_id'])) {
                $data['client_name'] = $entity->client->getDisplayName();
            }
            Utils::notifyZapier($subscription, $data);
        }
    }