<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class PricingRule extends Model
{
    protected $table = 'pricing_rules';

    protected $fillable = ['id', 'product_id', 'price', 'created_at', 'updated_at'];

    public function detail() {
        return $this->hasMany(PricingRuleOption::class, 'pricing_rule_id', 'id');
    }

    public function pricing() {
        return $this->hasMany(PricingRuleDetail::class, 'pricing_rule_id', 'id')->with('options');
    }
}
