Skip to content

Commit

Permalink
Associate countries to tax zone
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Jan 2, 2025
1 parent 0366d02 commit edf5077
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/core/src/Console/InstallLunar.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Lunar\Models\Product;
use Lunar\Models\ProductType;
use Lunar\Models\TaxClass;

use Lunar\Models\TaxZone;
use function Laravel\Prompts\confirm;

class InstallLunar extends Command
Expand Down Expand Up @@ -136,6 +136,23 @@ public function handle(): void
]);
}

if (! TaxZone::count()) {
$this->components->info('Adding a default tax zone.');

$taxZone = TaxZone::create([
'name' => 'Default Tax Zone',
'zone_type' => 'country',
'price_display' => 'tax_exclusive',
'default' => true,
'active' => true,
]);
$taxZone->countries()->createMany(
Country::get()->map(fn ($country) => [
'country_id' => $country->id,
])
);
}

if (! Attribute::count()) {
$this->components->info('Setting up initial attributes');

Expand Down

0 comments on commit edf5077

Please sign in to comment.