belongsTo(Order::class, 'order_id'); } public function addons() { return $this->hasMany(OrderAddon::class, 'order_item_id'); } public function getProductAttribute() { if ($this->product_id) { return Product::find($this->product_id); } return null; } /** * Relationship: OrderItem belongs to Product (new system) */ public function product() { return $this->belongsTo(Product::class, 'product_id'); } /** * Relationship: OrderItem has pricing info */ public function pricing() { return $this->belongsTo(ProductPricings::class, 'product_pricing_id'); } public function os() { return $this->belongsTo(Os::class, 'os_id'); } }