You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\AdminAgent\Renderable;use App\Models\IndustryProductSpec;use Dcat\Admin\Admin;use Dcat\Admin\Grid;use Dcat\Admin\Grid\LazyRenderable;
/** * 选择行业产品规格 * Class SelectProduct * @package App\AdminAgent\Renderable */class SelectIndustryProductSpec extends LazyRenderable{ public function grid(): Grid { // 获取外部传递的参数
// $id = $this->id;
Admin::translation('product'); return Grid::make(new IndustryProductSpec(), function (Grid $grid) { $grid->disableActions(); $grid->disableBatchDelete(); $grid->disableBatchActions();
$grid->model()->where([ ['stock', '>', 0], ['date', '>=', date('Y-m-d')], ['industry_product_id', '=', $this->industry_product_id], ])->selectRaw('*,concat(name, " | ", date) AS title');
$grid->quickSearch(['name', 'date'])->placeholder('搜索规格名称、日期');
$grid->column('id'); $grid->column('name'); $grid->column('date'); $grid->column('stock'); $grid->column('original_price'); $grid->column('price');
$grid->paginate(15);
$grid->filter(function (Grid\Filter $filter) { $filter->panel(); $filter->like('name')->width(3); $filter->like('date')->width(2); }); }); }}
|