<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Tracking\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Grid\Displayer\ItemOperate; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use ModStart\Widget\TextDialogRequest; class ProductController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $P0Vsm) { $P0Vsm->init('tracking_product')->field(function ($P0Vsm) { $P0Vsm->id('id', 'ID'); $P0Vsm->text('title', '名称')->required(); $P0Vsm->text('sn', '产品编号')->required()->ruleUnique('tracking_product'); $P0Vsm->text('barcode', '产品条形码')->required()->ruleUnique('tracking_product'); $P0Vsm->image('cover', '产品主图')->required(); $P0Vsm->images('images', '产品多图')->listable(false); $P0Vsm->richHtml('content', '内容')->listable(false); $P0Vsm->display('created_at', L('Created At'))->listable(false); $P0Vsm->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $roX32) { $roX32->eq('id', L('ID')); $roX32->like('title', L('Title')); })->hookItemOperateRendering(function (ItemOperate $DpxJh) { $lDvaK = $DpxJh->item(); $Ly6Nx = array(); $Ly6Nx[] = TextDialogRequest::make('primary', '<i class="iconfont icon-list-alt"></i> 信息块', modstart_admin_url('tracking/product_section/' . $lDvaK->id))->width('98%')->height('98%'); $DpxJh->prepend($Ly6Nx); })->title('产品管理'); } }