Merge pull request #2694 from Haendlerbund/missing-relations
introduce cart belongsTo Relation in Order Model
This commit is contained in:
commit
0a595fc0d8
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Sales\Models;
|
||||
|
||||
use Webkul\Checkout\Models\CartProxy;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Sales\Contracts\Order as OrderContract;
|
||||
|
||||
|
|
@ -61,6 +62,15 @@ class Order extends Model implements OrderContract
|
|||
return $this->grand_total - $this->grand_total_invoiced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the associated cart that was used to create this order.
|
||||
*/
|
||||
public function cart()
|
||||
{
|
||||
return $this->belongsTo(CartProxy::modelClass());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the order items record associated with the order.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class OrderItem extends Model implements OrderItemContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the order record associated with the order item.
|
||||
* Get the product record associated with the order item.
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue