Deploy / deploy (push) Successful in 26s
- Add SKU and GTIN fields to product variant repeater - Render EAN/UPC barcode live from GTIN input (picqer/php-barcode-generator) - Pull variant price from Shopify API instead of defaulting to 0 - Sync sku/gtin through EditProduct and CreateProduct save logic Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
918 B
PHP
31 lines
918 B
PHP
<?php
|
|
|
|
namespace App\Filament\User\Resources\ProductResource\Pages;
|
|
|
|
use App\Filament\User\Resources\ProductResource;
|
|
use Filament\Resources\Pages\CreateRecord;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Models\ProductSize;
|
|
|
|
class CreateProduct extends CreateRecord
|
|
{
|
|
protected static string $resource = ProductResource::class;
|
|
|
|
protected function handleRecordCreation(array $data): Model {
|
|
|
|
$record = static::getModel()::create($data);
|
|
|
|
foreach ($data['sizes'] as $size) {
|
|
ProductSize::create([
|
|
'product_id' => $record->id,
|
|
'packing_id' => $size['packing_id'],
|
|
'description' => $size['description'] ?? null,
|
|
'price' => $size['price'],
|
|
'sku' => $size['sku'] ?? null,
|
|
'gtin' => $size['gtin'] ?? null,
|
|
]);
|
|
}
|
|
return $record;
|
|
}
|
|
}
|