Query optimisations using with()
This commit is contained in:
@@ -8,7 +8,6 @@ class Invoice extends Model
|
||||
{
|
||||
protected $table = 'ab_invoice';
|
||||
protected $dates = ['date_orig','due_date'];
|
||||
protected $with = ['account.country.currency','items.taxes','paymentitems'];
|
||||
|
||||
protected $appends = [
|
||||
'date_due',
|
||||
@@ -25,6 +24,12 @@ class Invoice extends Model
|
||||
'total',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'account.country.currency',
|
||||
'items.taxes',
|
||||
'paymentitems'
|
||||
];
|
||||
|
||||
private $_total = 0;
|
||||
private $_total_tax = 0;
|
||||
|
||||
|
@@ -12,6 +12,7 @@ class InvoiceItem extends Model
|
||||
{
|
||||
protected $dates = ['date_start','date_stop'];
|
||||
public $dateFormat = 'U';
|
||||
|
||||
protected $table = 'ab_invoice_item';
|
||||
|
||||
private $_tax = 0;
|
||||
|
@@ -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',
|
||||
|
@@ -7,10 +7,10 @@ use App\Traits\NextKey;
|
||||
class Domain extends \App\Models\Base\ServiceType
|
||||
{
|
||||
use NextKey;
|
||||
|
||||
const RECORD_ID = 'service__domain';
|
||||
|
||||
protected $table = 'ab_service__domain';
|
||||
protected $with = ['tld'];
|
||||
|
||||
public function tld()
|
||||
{
|
||||
|
@@ -7,7 +7,6 @@ use App\Traits\NextKey;
|
||||
class Host extends \App\Models\Base\ServiceType
|
||||
{
|
||||
use NextKey;
|
||||
|
||||
const RECORD_ID = 'service__hosting';
|
||||
|
||||
protected $table = 'ab_service__hosting';
|
||||
|
@@ -7,7 +7,6 @@ use App\Traits\NextKey;
|
||||
class SSL extends \App\Models\Base\ServiceType
|
||||
{
|
||||
use NextKey;
|
||||
|
||||
const RECORD_ID = 'service__ssl';
|
||||
|
||||
protected $table = 'ab_service__ssl';
|
||||
|
Reference in New Issue
Block a user