mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Rework the webhooks table, allow to update exists webhooks
This commit is contained in:
		@@ -6,6 +6,7 @@ namespace common\tasks;
 | 
			
		||||
use common\models\Account;
 | 
			
		||||
use common\models\WebHook;
 | 
			
		||||
use Yii;
 | 
			
		||||
use yii\db\Expression;
 | 
			
		||||
use yii\queue\RetryableJobInterface;
 | 
			
		||||
 | 
			
		||||
final class CreateWebHooksDeliveries implements RetryableJobInterface {
 | 
			
		||||
@@ -67,8 +68,9 @@ final class CreateWebHooksDeliveries implements RetryableJobInterface {
 | 
			
		||||
    public function execute($queue): void {
 | 
			
		||||
        /** @var WebHook[] $targets */
 | 
			
		||||
        $targets = WebHook::find()
 | 
			
		||||
            ->joinWith('events e', false)
 | 
			
		||||
            ->andWhere(['e.event_type' => $this->type])
 | 
			
		||||
            // 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`, '\"{$this->type}\"')"))
 | 
			
		||||
            ->all();
 | 
			
		||||
        foreach ($targets as $target) {
 | 
			
		||||
            $job = new DeliveryWebHook();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user