Optimising product category and category names
This commit is contained in:
@@ -40,22 +40,23 @@ class ServiceList extends Command
|
||||
'Type',
|
||||
'Product',
|
||||
'Name',
|
||||
'active',
|
||||
'status',
|
||||
'invoice next',
|
||||
'start date',
|
||||
'stop date',
|
||||
'connect date',
|
||||
'first invoice'
|
||||
'Active',
|
||||
'Status',
|
||||
'Next Invoice',
|
||||
'Start Date',
|
||||
'Stop Date',
|
||||
'Connect Date',
|
||||
'First Invoice'
|
||||
));
|
||||
|
||||
foreach (Service::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->with(['site'])->cursor() as $o) {
|
||||
//dd($o,$o->site);
|
||||
if ((! $this->option('inactive')) AND ! $o->isActive())
|
||||
continue;
|
||||
|
||||
Config::set('site',$o->site);
|
||||
|
||||
if ($this->option('type') AND ($o->product->getProductTypeAttribute() !== $this->option('type')))
|
||||
if ($this->option('type') AND ($o->product->getCategoryAttribute() !== $this->option('type')))
|
||||
continue;
|
||||
|
||||
$c = $o->invoice_items->filter(function($item) {return $item->item_type === 0; })->sortby('start_at')->first();
|
||||
@@ -67,14 +68,14 @@ class ServiceList extends Command
|
||||
|
||||
$this->info(sprintf($header,
|
||||
$o->sid,
|
||||
$o->product->getProductTypeAttribute(),
|
||||
$o->product->getCategoryNameAttribute(),
|
||||
substr($o->product->getNameAttribute(),0,35),
|
||||
substr($o->name_short,0,40),
|
||||
$o->active ? 'active' : 'inactive',
|
||||
$o->status,
|
||||
$o->invoice_next ? $o->invoice_next->format('Y-m-d') : NULL,
|
||||
$o->start_at ? $o->start_at->format('Y-m-d') : NULL,
|
||||
$o->stop_at ? $o->stop_at->format('Y-m-d') : NULL,
|
||||
$o->invoice_next?->format('Y-m-d'),
|
||||
$o->start_at?->format('Y-m-d'),
|
||||
$o->stop_at?->format('Y-m-d'),
|
||||
($o->type AND $o->type->connect_at) ? $o->type->connect_at->format('Y-m-d') : NULL,
|
||||
($c && $c->date_start) ? $c->date_start->format('Y-m-d') : NULL,
|
||||
));
|
||||
|
Reference in New Issue
Block a user