From 6327b5b417693bcfaf3b7c8c9ba4853d050e9178 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Tue, 25 Oct 2022 17:32:43 +0200 Subject: [PATCH] Set TenantDump's path to configured schema-path if the path doesn't get passed --- src/Commands/TenantDump.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Commands/TenantDump.php b/src/Commands/TenantDump.php index 6edae6b0..5021787f 100644 --- a/src/Commands/TenantDump.php +++ b/src/Commands/TenantDump.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Stancl\Tenancy\Commands; -use Illuminate\Contracts\Events\Dispatcher; -use Illuminate\Database\ConnectionResolverInterface; -use Illuminate\Database\Console\DumpCommand; use Stancl\Tenancy\Contracts\Tenant; +use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Database\Console\DumpCommand; use Symfony\Component\Console\Input\InputOption; +use Illuminate\Database\ConnectionResolverInterface; class TenantDump extends DumpCommand { @@ -22,6 +22,10 @@ class TenantDump extends DumpCommand public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher): int { + if (is_null($this->option('path'))) { + $this->input->setOption('path', config('tenancy.migration_parameters.--schema-path')); + } + $tenant = $this->option('tenant') ?? tenant() ?? $this->ask('What tenant do you want to dump the schema for?')