From 63441be08e181b54e324e77a4ffed972afb763eb Mon Sep 17 00:00:00 2001 From: JonPurvis Date: Wed, 6 Sep 2023 00:41:27 +0100 Subject: [PATCH] make integrations path dynamic --- config/saloon.php | 14 ++++++++++++++ src/Console/Commands/ListCommand.php | 2 +- src/SaloonServiceProvider.php | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config/saloon.php b/config/saloon.php index 3a6fba9..53e0777 100644 --- a/config/saloon.php +++ b/config/saloon.php @@ -20,4 +20,18 @@ 'default_sender' => GuzzleSender::class, + /* + |-------------------------------------------------------------------------- + | Integrations Path + |-------------------------------------------------------------------------- + | + | By default, this package will create any classes within + | /app/Http/Integrations directory. If you're using + | a different design approach, then your classes + | may be in a different place. You can change + | that location so that the saloon:list + | command will still find your files + | + */ + 'integrations_path' => 'App/Http/Integrations', ]; diff --git a/src/Console/Commands/ListCommand.php b/src/Console/Commands/ListCommand.php index 6493eb5..fc4e1c5 100644 --- a/src/Console/Commands/ListCommand.php +++ b/src/Console/Commands/ListCommand.php @@ -70,7 +70,7 @@ public function handle() protected function getIntegrations(): array { - return glob('app/Http/Integrations/*') ?? []; + return glob(config('saloon.integrations_path').'/*') ?? []; } protected function getIntegrationConnectors(string $integration): array diff --git a/src/SaloonServiceProvider.php b/src/SaloonServiceProvider.php index 2962bdd..a43c4da 100644 --- a/src/SaloonServiceProvider.php +++ b/src/SaloonServiceProvider.php @@ -8,6 +8,7 @@ use Saloon\Enums\PipeOrder; use Saloon\Contracts\Sender; use Illuminate\Support\ServiceProvider; +use Saloon\Laravel\Console\Commands\ListCommand; use Saloon\Laravel\Http\Faking\MockClient; use Saloon\Laravel\Console\Commands\MakePlugin; use Saloon\Laravel\Console\Commands\MakeRequest; @@ -83,6 +84,7 @@ protected function registerCommands(): self MakeResponse::class, MakePlugin::class, MakeAuthenticator::class, + ListCommand::class, ]); return $this;