Files
SpiceManagementSystem/app/Models/ProductSize.php
T
Malek TellissiandClaude Sonnet 4.6 467d85dfec
Deploy / deploy (push) Successful in 14s
Add Shopify inventory sync and order webhook
- Migration: shopify_variant_id on products_sizes, shopify_order_id on products_sales
- ShopifyService: paginated REST client (2024-10 API)
- shopify:map — one-time command to link variants by SKU
- shopify:sync — reconciliation command (Shopify is master)
- VerifyShopifyWebhook middleware: HMAC-SHA256 verification
- ShopifyWebhookController: idempotent orders/paid handler, FIFO inventory deduction
- Webhook route: POST /api/webhooks/shopify/orders-paid

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-11 02:53:49 +02:00

26 lines
607 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductSize extends Model
{
use HasFactory;
protected $table = 'products_sizes';
protected $fillable = ['product_id', 'packing_id', 'sku', 'shopify_variant_id', 'price', 'description'];
public function product() {
return $this->belongsTo(Product::class);
}
public function packing() {
return $this->belongsTo(Packing::class);
}
public function inventories() {
return $this->hasMany(ProductInventory::class);
}
}