Files
SpiceManagementSystem/app/Models/Product.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

38 lines
832 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $fillable = ['title', 'description', 'images', 'package_content', 'recipes_id'];
protected $casts = [
'images' => 'array',
];
public function recipe()
{
return $this->belongsTo(Recipe::class, 'recipes_id');
}
public function sizes()
{
return $this->belongsToMany(Packing::class, 'products_sizes')
->withPivot('price', 'description', 'sku', 'gtin')
->withTimestamps();
}
public function inventories()
{
return $this->hasMany(ProductInventory::class);
}
public function batches()
{
return $this->hasMany(Batch::class);
}
}