Browse Source

orderBy('supplier_date')

master
李可松 4 years ago
parent
commit
6360fef7b1
  1. 17
      app/AdminAgent/Forms/LoadSupplierSpec.php

17
app/AdminAgent/Forms/LoadSupplierSpec.php

@ -21,6 +21,7 @@ class LoadSupplierSpec extends Form implements LazyRenderable
->pluck('product_spec_id')->toArray();
$spec = ProductSpec::where('product_id', $id)
->whereNotIn('id', $agent_spec ?? [0])
->orderBy('supplier_date')
->get([
'id AS product_spec_id',
'name AS supplier_name',
@ -29,13 +30,15 @@ class LoadSupplierSpec extends Form implements LazyRenderable
'stock AS supplier_stock',
])->toArray();
} else {
$spec = ProductSpec::where('product_id', $id)->get([
'id AS product_spec_id',
'name AS supplier_name',
'date AS supplier_date',
'price AS supplier_price',
'stock AS supplier_stock',
])->toArray();
$spec = ProductSpec::where('product_id', $id)
->orderBy('supplier_date')
->get([
'id AS product_spec_id',
'name AS supplier_name',
'date AS supplier_date',
'price AS supplier_price',
'stock AS supplier_stock',
])->toArray();
}
return $this->response()->data($spec);

Loading…
Cancel
Save