<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ProductVariant extends Model
{

    protected $fillable = [
        'product_id',
        'color',
        'sku',
        'stock',
        'price'
    ];

    public function product()
    {
        return $this->belongsTo(Product::class);
    }

    public function images() 
    {
        return $this->hasMany(ProductImage::class);
    }

    public function stockLogs()
    {
        return $this->hasMany(StockLog::class)->latest();
    }
}