Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed Sep 9, 2024
1 parent 675bc77 commit 5d97579
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Add the API key of your email service provider to the `config/services.php` file
When done, run this command with the slug of your service provider:

```bash
php artisan mails:webhooks [service] // where [service] is your provider, e.g. postmark or mailgun
php artisan mail:webhooks [service] // where [service] is your provider, e.g. postmark or mailgun
```

And for changing the configuration you can publish the config file with:
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/RegisterWebhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class RegisterWebhooks
{
use AsAction, InteractsWithIO;

public function handle(Factory $components)
public function handle(string $provider, Factory $components)
{
MailProvider::with('postmark')->registerWebhooks(
MailProvider::with($provider)->registerWebhooks(
components: $components
);
}
Expand Down
18 changes: 13 additions & 5 deletions src/Commands/WebhooksMailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@

class WebhooksMailCommand extends Command
{
public $signature = 'mail:webhooks';
public $signature = 'mail:webhooks {provider}';

public $description = 'Register webhooks for email providers';
public $description = 'Register event webhooks for email provider';

public function handle(): int
{
(new RegisterWebhooks)($this->components);

$this->comment('All done');
(new RegisterWebhooks)(
provider: $this->argument('provider'),

Check failure on line 17 in src/Commands/WebhooksMailCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Unknown parameter $provider in call to callable Vormkracht10\Mails\Actions\RegisterWebhooks.
components: $this->components

Check failure on line 18 in src/Commands/WebhooksMailCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Unknown parameter $components in call to callable Vormkracht10\Mails\Actions\RegisterWebhooks.
);

return self::SUCCESS;
}

protected function promptForMissingArgumentsUsing(): array
{
return [
'provider' => 'Which email provider would you like to register webhooks for?',
];
}
}

0 comments on commit 5d97579

Please sign in to comment.