Query optimisations using with()

This commit is contained in:
Deon George
2020-02-10 22:07:46 +11:00
parent cd18b98859
commit f41fc3eb9c
8 changed files with 101 additions and 33 deletions

View File

@@ -24,20 +24,6 @@ class Service extends Model
const CREATED_AT = 'date_orig';
const UPDATED_AT = 'date_last';
protected $dates = [
'date_last_invoice',
'date_next_invoice'.
'date_start',
'date_end',
];
public $dateFormat = 'U';
protected $table = 'ab_service';
protected $casts = [
'order_info'=>'array',
];
protected $appends = [
'account_name',
'admin_service_id_url',
@@ -51,6 +37,20 @@ class Service extends Model
'status',
];
protected $casts = [
'order_info'=>'array',
];
protected $dates = [
'date_last_invoice',
'date_next_invoice'.
'date_start',
'date_end',
];
public $dateFormat = 'U';
protected $table = 'ab_service';
protected $visible = [
'account_name',
'admin_service_id_url',
@@ -67,6 +67,14 @@ class Service extends Model
'status',
];
protected $with = [
'account.language',
'charges',
'invoice_items',
'product',
'type',
];
private $inactive_status = [
'CANCELLED',
'ORDER-REJECTED',