6
0
Fork 0
jiqu-library-server/app/Admin/Renderable/ProductPartSpuTable.php

27 lines
737 B
PHP

<?php
namespace App\Admin\Renderable;
use App\Models\ProductPartSku;
use App\Models\ProductPartSpu;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class ProductPartSpuTable extends LazyRenderable
{
public function grid(): Grid
{
$partId = $this->payload['id'];
// dd($partId);
$builder = ProductPartSpu::query();
$builder->with('spu')->where('part_id', $partId);
return Grid::make($builder, function (Grid $grid) {
$grid->column('spu.name', __('product-sku.fields.name'));
$grid->column('sort');
$grid->quickSearch(['spu.name']);
$grid->model()->orderBy('sort', 'desc');
$grid->disableActions();
});
}
}