@@ -184,7 +184,7 @@ |
||
| 184 | 184 | /** |
| 185 | 185 | * Call all webhooks asynchronous |
| 186 | 186 | * |
| 187 | - * @param array $webhooks |
|
| 187 | + * @param \Illuminate\Support\Collection $webhooks |
|
| 188 | 188 | * @param $eventData |
| 189 | 189 | */ |
| 190 | 190 | private function callWebhooks($webhooks, $eventData) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | protected function publishConfig() |
| 88 | 88 | { |
| 89 | 89 | $this->publishes([ |
| 90 | - __DIR__.'/../../config/config.php' => config_path('captain_hook.php'), |
|
| 90 | + __DIR__ . '/../../config/config.php' => config_path('captain_hook.php'), |
|
| 91 | 91 | ]); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | protected function registerEventListeners() |
| 98 | 98 | { |
| 99 | 99 | foreach ($this->listeners as $eventName) { |
| 100 | - $this->app[ 'events' ]->listen($eventName, [$this, 'handleEvent']); |
|
| 100 | + $this->app['events']->listen($eventName, [$this, 'handleEvent']); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function setWebhooks($webhooks) |
| 118 | 118 | { |
| 119 | 119 | $this->webhooks = $webhooks; |
| 120 | - $this->getCache()->rememberForever(Webhook::CACHE_KEY, function () { |
|
| 120 | + $this->getCache()->rememberForever(Webhook::CACHE_KEY, function() { |
|
| 121 | 121 | return $this->webhooks; |
| 122 | 122 | }); |
| 123 | 123 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function getWebhooks() |
| 129 | 129 | { |
| 130 | 130 | if (!$this->getCache()->has(Webhook::CACHE_KEY)) { |
| 131 | - $this->getCache()->rememberForever(Webhook::CACHE_KEY, function () { |
|
| 131 | + $this->getCache()->rememberForever(Webhook::CACHE_KEY, function() { |
|
| 132 | 132 | return Webhook::all(); |
| 133 | 133 | }); |
| 134 | 134 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | private function callWebhooks($webhooks, $eventData) |
| 191 | 191 | { |
| 192 | 192 | foreach ($webhooks as $webhook) { |
| 193 | - $this->client->postAsync($webhook[ 'url' ], [ |
|
| 193 | + $this->client->postAsync($webhook['url'], [ |
|
| 194 | 194 | 'body' => json_encode($this->createRequestBody($eventData)), |
| 195 | 195 | 'verify' => false, |
| 196 | 196 | 'future' => true |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | protected function registerCommands() |
| 218 | 218 | { |
| 219 | - $this->app[ 'hook.list' ] = $this->app->share(function () { |
|
| 219 | + $this->app['hook.list'] = $this->app->share(function() { |
|
| 220 | 220 | return new ListWebhooks(); |
| 221 | 221 | }); |
| 222 | 222 | |
| 223 | - $this->app[ 'hook.add' ] = $this->app->share(function () { |
|
| 223 | + $this->app['hook.add'] = $this->app->share(function() { |
|
| 224 | 224 | return new AddWebhook(); |
| 225 | 225 | }); |
| 226 | 226 | |
| 227 | - $this->app[ 'hook.delete' ] = $this->app->share(function () { |
|
| 227 | + $this->app['hook.delete'] = $this->app->share(function() { |
|
| 228 | 228 | return new DeleteWebhook(); |
| 229 | 229 | }); |
| 230 | 230 | |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | { |
| 33 | 33 | parent::boot(); |
| 34 | 34 | |
| 35 | - static::created(function ($results) { |
|
| 35 | + static::created(function($results) { |
|
| 36 | 36 | Cache::forget(self::CACHE_KEY); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | - static::deleted(function ($results) { |
|
| 39 | + static::deleted(function($results) { |
|
| 40 | 40 | Cache::forget(self::CACHE_KEY); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | | The tenant_id field can be used for verification. |
| 20 | 20 | | |
| 21 | 21 | */ |
| 22 | - 'filter' => function ($webhook) { |
|
| 22 | + 'filter' => function($webhook) { |
|
| 23 | 23 | return true; |
| 24 | 24 | }, |
| 25 | 25 | ]; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('webhooks', function (Blueprint $table) { |
|
| 15 | + Schema::create('webhooks', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->integer('tenant_id')->nullable(); |
| 18 | 18 | $table->string('url'); |