<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class LabkitOrderItem extends Model
{
    use HasFactory;
    // The table associated with the model.
    protected $table = 'labkit_order_items';

    // The attributes that are mass assignable.
    protected $fillable = [
        'cart_id',
        'item_id',
        'result',
        'status',
        'lab_kit_id'
    ];

    // Define the relationship with the Cart model
    public function cart()
    {
        return $this->belongsTo(Cart::class);
    }

    // Define the relationship with the Item model
    public function item()
    {
        return $this->belongsTo(Item::class);
    }

    public function labkitOrderItems()
    {
        return $this->hasMany(LabkitOrderItem::class);
    }

    public function labKit()
    {
        return $this->belongsTo(LabKit::class);
    }
}
