Merge pull request #2694 from Haendlerbund/missing-relations

introduce cart belongsTo Relation in Order Model
This commit is contained in:
Jitendra Singh 2020-03-19 14:33:35 +05:30 committed by GitHub
commit 0a595fc0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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.
*/

View File

@ -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()
{