sarga/packages/Webkul/Sales/src/Models/OrderItem.php

42 lines
991 B
PHP
Raw Normal View History

<?php
namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\OrderItem as OrderItemContract;
class OrderItem extends Model implements OrderItemContract
{
2018-10-05 06:18:58 +00:00
protected $guarded = ['id', 'child', 'created_at', 'updated_at'];
/**
* Get the order record associated with the order item.
*/
public function order()
{
return $this->belongsTo(OrderProxy::modelClass());
}
/**
* Get the order record associated with the order item.
*/
public function product()
{
return $this->morphTo();
}
/**
* Get the child item record associated with the order item.
*/
public function child()
{
return $this->belongsTo(OrderItemProxy::modelClass(), 'parent_id');
}
2018-10-05 06:18:58 +00:00
/**
* Get the inventories record associated with the order item.
*/
public function inventories() {
return $this->hasMany(CartItemInventoyrProxy::modelClass());
}
}