base
parent
618a3ec593
commit
ced19dc09b
|
|
@ -59,7 +59,7 @@ class ProductController extends AdminController
|
||||||
$grid->column('productSku.sell_price', '销售价')->display(function ($value) {
|
$grid->column('productSku.sell_price', '销售价')->display(function ($value) {
|
||||||
return bcdiv($value, 100, 2);;
|
return bcdiv($value, 100, 2);;
|
||||||
});
|
});
|
||||||
$grid->column('amount', '库存')->sortable();
|
$grid->column('amount', '库存')->editable();
|
||||||
$grid->column('status', '状态')->switch();
|
$grid->column('status', '状态')->switch();
|
||||||
$grid->paginate(10);
|
$grid->paginate(10);
|
||||||
|
|
||||||
|
|
@ -120,6 +120,7 @@ class ProductController extends AdminController
|
||||||
$form->select('product_sku_id')->options(ProductSku::class)->ajax('api/product-skus');
|
$form->select('product_sku_id')->options(ProductSku::class)->ajax('api/product-skus');
|
||||||
$form->hidden('product_spu_id');
|
$form->hidden('product_spu_id');
|
||||||
$form->switch('status', '状态')->default(1);
|
$form->switch('status', '状态')->default(1);
|
||||||
|
$form->number('amount');
|
||||||
$form->saving(function (Form $form) {
|
$form->saving(function (Form $form) {
|
||||||
if ($form->isCreating()) {
|
if ($form->isCreating()) {
|
||||||
$store_id = $form->input('store_id');
|
$store_id = $form->input('store_id');
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class ExportGoodsForm extends Form
|
||||||
ProductSku::create([
|
ProductSku::create([
|
||||||
'store_id' => $store->id,
|
'store_id' => $store->id,
|
||||||
'product_sku_id' => $sku->id,
|
'product_sku_id' => $sku->id,
|
||||||
|
'product_spu_id' => $sku->spu_id,
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class StoreProduct
|
||||||
if ($rowAttrs) {
|
if ($rowAttrs) {
|
||||||
$format_specs = $this->formatAttr($rowAttrs);
|
$format_specs = $this->formatAttr($rowAttrs);
|
||||||
$format_attrs = $this->formatAttr($rowSpecs);
|
$format_attrs = $this->formatAttr($rowSpecs);
|
||||||
$spec_group = $this->getSpec($cells[0], $rowAttrs, $rowSpecs);
|
$spec_group = $this->getSpec($goodsName, $rowAttrs, $rowSpecs);
|
||||||
|
|
||||||
$attrs = [];
|
$attrs = [];
|
||||||
foreach($spec_group->attrs as $index => $item) {
|
foreach($spec_group->attrs as $index => $item) {
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,11 @@ class ArticleController extends Controller
|
||||||
*/
|
*/
|
||||||
public function show($id, Request $request)
|
public function show($id, Request $request)
|
||||||
{
|
{
|
||||||
$article = Article::with(['likesInfo'=>function ($q) use ($request) {
|
$article = Article::with([
|
||||||
return $q->where('user_id', $request->user()->id);
|
'likesInfo' => function ($q) use ($request) {
|
||||||
}])->where('is_show', 1)->findOrFail($id);
|
return $q->where('user_id', $request->user()?->id);
|
||||||
|
}
|
||||||
|
])->where('is_show', 1)->findOrFail($id);
|
||||||
return ArticleResource::make($article);
|
return ArticleResource::make($article);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue