From 6647ce8c6c7dc6d441a28bc458ecd472cc9c65a9 Mon Sep 17 00:00:00 2001 From: Lee Overy Date: Sun, 9 Feb 2020 10:43:16 +0000 Subject: [PATCH] WIP --- resources/views/app/webhooks/index.blade.php | 6 ++++++ routes/web.php | 18 +++++++++--------- .../{ => Clients}/ClientIndexController.php | 2 +- .../{ => Clients}/CreateClientController.php | 2 +- .../{ => Clients}/DestroyClientController.php | 2 +- .../ActivateWebhookController.php | 2 +- .../{ => Webhooks}/CreateWebhookController.php | 2 +- .../DeactivateWebhookController.php | 2 +- .../DestroyWebhookController.php | 2 +- .../{ => Webhooks}/EditWebhookController.php | 2 +- .../{ => Webhooks}/WebhookIndexController.php | 2 +- src/MailcoachApiServiceProvider.php | 2 +- src/Support/Triggers.php | 15 ++++----------- 13 files changed, 29 insertions(+), 30 deletions(-) rename src/Http/App/Controllers/{ => Clients}/ClientIndexController.php (84%) rename src/Http/App/Controllers/{ => Clients}/CreateClientController.php (88%) rename src/Http/App/Controllers/{ => Clients}/DestroyClientController.php (86%) rename src/Http/App/Controllers/{ => Webhooks}/ActivateWebhookController.php (82%) rename src/Http/App/Controllers/{ => Webhooks}/CreateWebhookController.php (87%) rename src/Http/App/Controllers/{ => Webhooks}/DeactivateWebhookController.php (82%) rename src/Http/App/Controllers/{ => Webhooks}/DestroyWebhookController.php (82%) rename src/Http/App/Controllers/{ => Webhooks}/EditWebhookController.php (93%) rename src/Http/App/Controllers/{ => Webhooks}/WebhookIndexController.php (86%) diff --git a/resources/views/app/webhooks/index.blade.php b/resources/views/app/webhooks/index.blade.php index aaa19b3..8a3c859 100644 --- a/resources/views/app/webhooks/index.blade.php +++ b/resources/views/app/webhooks/index.blade.php @@ -30,6 +30,7 @@ Name Url Triggers + Fired @@ -57,6 +58,11 @@ {{ $webhook->trigger_list_count }} + + + {{ $webhook->webhookEvents()->count() }} + + {{ $webhook->created_at->toMailcoachFormat() }} diff --git a/routes/web.php b/routes/web.php index 1b03bc4..16dcb5a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,16 +1,16 @@ group(function () { diff --git a/src/Http/App/Controllers/ClientIndexController.php b/src/Http/App/Controllers/Clients/ClientIndexController.php similarity index 84% rename from src/Http/App/Controllers/ClientIndexController.php rename to src/Http/App/Controllers/Clients/ClientIndexController.php index df2df69..44f4e8f 100644 --- a/src/Http/App/Controllers/ClientIndexController.php +++ b/src/Http/App/Controllers/Clients/ClientIndexController.php @@ -1,6 +1,6 @@ mergeConfigFrom(__DIR__.'/../config/mailcoach-api.php', 'mailcoach-api'); $this->app->singleton(Triggers::class, function () { - return new Triggers(collect($this->actionMap)); + return new Triggers($this->actionMap); }); Event::listen('Spatie\Mailcoach\Events\*', MailcoachEventListener::class); diff --git a/src/Support/Triggers.php b/src/Support/Triggers.php index 9624b98..75e824a 100644 --- a/src/Support/Triggers.php +++ b/src/Support/Triggers.php @@ -4,27 +4,20 @@ use Illuminate\Support\Collection; -class Triggers +class Triggers extends Collection { - private Collection $eventMap; - - public function __construct(Collection $eventMap) - { - $this->eventMap = $eventMap; - } - public function events() { - return $this->eventMap->values(); + return $this->values(); } public function hasEvent($event) { - return $this->eventMap->has($event); + return $this->has($event); } public function getTriggerKey($event) { - return $this->eventMap->get($event); + return $this->get($event); } } \ No newline at end of file