Removed Child Relationship

This commit is contained in:
devansh bawari 2021-08-13 11:39:10 +05:30
parent 41f74990fe
commit 8f676435ac
1 changed files with 14 additions and 12 deletions

View File

@ -7,6 +7,11 @@ use Webkul\Sales\Contracts\ShipmentItem as ShipmentItemContract;
class ShipmentItem extends Model implements ShipmentItemContract
{
/**
* The attributes that aren't mass assignable.
*
* @var string[]|bool
*/
protected $guarded = [
'id',
'child',
@ -14,12 +19,17 @@ class ShipmentItem extends Model implements ShipmentItemContract
'updated_at',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'additional' => 'array',
];
/**
* Retrieve type instance
* Retrieve type instance.
*
* @return AbstractType
*/
@ -27,7 +37,7 @@ class ShipmentItem extends Model implements ShipmentItemContract
{
return $this->order_item->getTypeInstance();
}
/**
* Get the shipment record associated with the shipment item.
*/
@ -53,18 +63,10 @@ class ShipmentItem extends Model implements ShipmentItemContract
}
/**
* Get the child item record associated with the shipment item.
*/
public function child()
{
return $this->belongsTo(ShipmentItemProxy::modelClass(), 'parent_id');
}
/**
* Get order item type
* Get order item type.
*/
public function getTypeAttribute()
{
return $this->order_item->type;
}
}
}