feat(variants): add minimum and maximum use dates to variants and update related logic
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('variantes', function (Blueprint $table): void {
|
||||
$table->dateTime('minimum_use_date')->nullable()->after('inventory_id');
|
||||
$table->dateTime('maximum_use_date')->nullable()->after('minimum_use_date');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('variantes', function (Blueprint $table): void {
|
||||
$table->dropColumn([
|
||||
'minimum_use_date',
|
||||
'maximum_use_date',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -38,6 +38,8 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
]);
|
||||
|
||||
$dates = ['2026-10-09', '2026-10-10', '2026-10-11', '2026-10-12'];
|
||||
$minimumUseDate = $dates[0].' 00:00:00';
|
||||
$maximumUseDate = $dates[array_key_last($dates)].' 23:59:59';
|
||||
|
||||
$generalAdmission = $this->catalogService->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
@@ -48,12 +50,14 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
'precio' => 10000,
|
||||
'inventory_policy' => InventoryPolicy::Unlimited->value,
|
||||
'has_tickets' => true,
|
||||
'minimum_use_date' => $dates[0].' 00:00:00',
|
||||
'maximum_use_date' => $dates[array_key_last($dates)].' 23:59:59',
|
||||
'minimum_use_date' => $minimumUseDate,
|
||||
'maximum_use_date' => $maximumUseDate,
|
||||
'attribute_codes' => ['fecha'],
|
||||
'variants' => array_map(
|
||||
fn (string $date): array => [
|
||||
'real_stock' => 0,
|
||||
'minimum_use_date' => $date.' 00:00:00',
|
||||
'maximum_use_date' => $date.' 23:59:59',
|
||||
'values' => ['fecha' => $date],
|
||||
],
|
||||
$dates,
|
||||
@@ -76,6 +80,8 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
'descripcion' => $item['descripcion'] ?? $item['nombre'],
|
||||
'inventory_policy' => InventoryPolicy::Unlimited->value,
|
||||
'real_stock' => 0,
|
||||
'minimum_use_date' => $minimumUseDate,
|
||||
'maximum_use_date' => $maximumUseDate,
|
||||
...$item,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user