<?php

namespace App\Models\Restaurant;

use Illuminate\Database\Eloquent\Model;
use App\Traits\ChecksTableExistence;

class Comanda extends Model
{
  //* Support & Extension
    use ChecksTableExistence;
    
  //* Associated Table & Primary Key
    protected $table = 'comandas';
    protected $primaryKey = 'id';

  //* Fillable Fields
    protected $fillable = [
        'order_id',
        'item',
        'category_id',
        'item_quantity',
        'item_price',
        'subtotal',
    ];

  //* Relationships
    public function order() {
        return $this->belongsTo(Order::class, 'order_id');
    }

    public function productCategory() {
        return $this->belongsTo(ProductCategory::class, 'category_id');
    }
}
