| xqd
@@ -33,13 +33,15 @@ class ProductHotController extends AdminController
|
|
|
*/
|
|
|
protected function grid()
|
|
|
{
|
|
|
- return Grid::make(ProductHot::with(['product']), function (Grid $grid) {
|
|
|
+ return Grid::make(new ProductHot(), function (Grid $grid) {
|
|
|
$grid->model()->orderByDesc('sort');
|
|
|
$grid->model()->where('type', $this->type);
|
|
|
$grid->column('id')->sortable();
|
|
|
$grid->column('cover_img')->image('',80);
|
|
|
$grid->column('product_id')->display(function (){
|
|
|
- return $this->product->name;
|
|
|
+ $this->products = $this->product_id;
|
|
|
+ $names = $this->products->pluck('name')->toArray();
|
|
|
+ return implode('、',$names);
|
|
|
});
|
|
|
$grid->column('is_opened')->switch();
|
|
|
$grid->column('sort')->editable();
|
| xqd
@@ -84,7 +86,7 @@ class ProductHotController extends AdminController
|
|
|
$form->display('id');
|
|
|
$form->hidden('type')->value($this->type);
|
|
|
$cates = Product::select(['id','name'])->where('is_opened',1)->get()->toArray();
|
|
|
- $form->select('product_id')
|
|
|
+ $form->multipleSelect('product_id')
|
|
|
->options(array_column($cates,'name','id'))
|
|
|
->required();
|
|
|
$form->image('cover_img')->saveFullUrl()
|