调整后台分类以及列表
parent
16b4398af9
commit
162d4fbd46
|
|
@ -24,10 +24,12 @@ class ProductCategoryController extends AdminController
|
|||
*/
|
||||
protected function grid()
|
||||
{
|
||||
return Grid::make(new ProductCategory(), function (Grid $grid) {
|
||||
$builder = ProductCategory::with('parent');
|
||||
return Grid::make($builder, function (Grid $grid) {
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('name')->tree();
|
||||
$grid->column('name');
|
||||
$grid->column('icon')->image(50, 50);
|
||||
$grid->column('parent.name', '上级分类')->label();
|
||||
$grid->column('is_show')
|
||||
->if(function () {
|
||||
return Admin::user()->can('dcat.admin.product_categories.edit');
|
||||
|
|
@ -71,6 +73,7 @@ class ProductCategoryController extends AdminController
|
|||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel();
|
||||
$filter->equal('name')->width(3);
|
||||
$filter->equal('parent_id', '上级分类')->select(ProductCategoryModel::selectOptions())->width(3);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class PartController extends Controller
|
|||
$part = ProductPart::where('key', $key)->first();
|
||||
}
|
||||
|
||||
$paginator = ProductPartSku::with('sku:id,name,cover,sell_price,vip_price')
|
||||
$paginator = ProductPartSku::with('sku:id,name,cover,sell_price,vip_price,market_price')
|
||||
->whereHas('sku', function ($query) {
|
||||
return $query->online();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -55,4 +55,9 @@ class ProductCategory extends Model
|
|||
{
|
||||
return $this->parent_id;
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(ProductCategory::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue