Skip to content

Commit

Permalink
Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
daVitekPL committed Oct 21, 2024
1 parent 270547a commit b8a09a4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

use Domain\Currency\Currency;
use Domain\Language\Language;
use Domain\PriceMap\PriceMap;
use Domain\SalesChannel\Enums\SalesChannelActivityType;
use Domain\SalesChannel\Enums\SalesChannelStatus;
use Domain\SalesChannel\Models\SalesChannel;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Str;

return new class extends Migration
{
Expand All @@ -16,12 +18,15 @@ public function up(): void
/** @var PriceMap $priceMap */
$priceMap = PriceMap::find($case->getDefaultPriceMapId());
if ($priceMap->salesChannels->count() === 0) {
SalesChannel::factory()->create([
SalesChannel::create([
'name' => 'Default channel for ' . $case->value,
'price_map_id' => $priceMap->id,
'status' => SalesChannelStatus::PRIVATE->value,
'activity' => SalesChannelActivityType::ACTIVE->value,
'default' => false,
'slug' => Str::slug('Default channel for ' . $case->value),
'language_id' => Language::default()->getKey(),
'vat_rate' => '0',
]);
}
}
Expand Down

0 comments on commit b8a09a4

Please sign in to comment.