Files
SpiceManagementSystem/app/Filament/User/Resources/ProductResource/Pages/CreateProduct.php
T
Malek TellissiandClaude Sonnet 4.6 25b32c717b
Deploy / deploy (push) Successful in 26s
Add SKU/GTIN fields, live barcode preview, and Shopify price import
- 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>
2026-09-12 04:46:00 +02:00

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;
}
}