From acf002f35dcf0f1ba01894e0b8f10e1f932514e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Wed, 31 May 2023 14:51:01 +0300 Subject: [PATCH] add default with company and item models --- app/Models/Common/Company.php | 2 ++ app/Models/Common/Item.php | 7 +++++++ app/Models/Document/DocumentItem.php | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php index 5756ac02c..a53d67ff0 100644 --- a/app/Models/Common/Company.php +++ b/app/Models/Common/Company.php @@ -27,6 +27,8 @@ class Company extends Eloquent implements Ownable protected $table = 'companies'; + protected $with = ['settings']; + /** * The accessors to append to the model's array form. * diff --git a/app/Models/Common/Item.php b/app/Models/Common/Item.php index c9f9433f8..64e5dbf9a 100644 --- a/app/Models/Common/Item.php +++ b/app/Models/Common/Item.php @@ -16,6 +16,13 @@ class Item extends Model protected $table = 'items'; + /** + * The relationships that should always be loaded. + * + * @var array + */ + protected $with = ['taxes']; + /** * The accessors to append to the model's array form. * diff --git a/app/Models/Document/DocumentItem.php b/app/Models/Document/DocumentItem.php index c108df951..ffaa3c7da 100644 --- a/app/Models/Document/DocumentItem.php +++ b/app/Models/Document/DocumentItem.php @@ -15,6 +15,13 @@ class DocumentItem extends Model protected $table = 'document_items'; + /** + * The relationships that should always be loaded. + * + * @var array + */ + protected $with = ['taxes']; + protected $appends = ['discount']; protected $fillable = [