Browse Source

修改自营产品title为空的情况

master
李可松 4 years ago
parent
commit
3ab61ec3fa
  1. 7
      app/AdminSupplier/Metrics/Examples/SalesExamples.php

7
app/AdminSupplier/Metrics/Examples/SalesExamples.php

@ -54,7 +54,7 @@ class SalesExamples extends Bar
public function fill()
{
$warehouse = OrderProductItem::query()
->with('product')
->with(['product', 'order:id,title'])
->select('*')
->addSelect(DB::raw('count(id) as count_id'))
->whereHas('order',function ($query) {
@ -68,9 +68,10 @@ class SalesExamples extends Bar
//$warehouse = [];
$data = $categories = [];
foreach ($warehouse as $v) {
array_push($this->labels, $v->product->title);
$title = $v->product->title ?? $v->title;
array_push($this->labels, $title);
array_push($data, $v->count_id);
$categories[] = [$v->product->title];
$categories[] = [$title];
}
$this->withChart($data, $categories);

Loading…
Cancel
Save