<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Tracking\Admin\Controller; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Form\Form; use ModStart\Repository\Filter\RepositoryFilter; use ModStart\Support\Concern\HasFields; class ProductSectionController extends Controller { use HasAdminQuickCRUD; public static $PermitMethodMap = array('*' => '\\Module\\Tracking\\Admin\\Controller\\ProductController@index'); private $productId = 0; private $product = null; public function __construct(Request $YZyN8) { goto wpRnL; wpRnL: $this->productId = intval($YZyN8->route('productId')); goto M4TeY; sCpOK: $this->useGridDialogPage(); goto QD0xp; M4TeY: BizException::throwsIfEmpty('productId为空', $this->productId); goto X7oar; gvNXf: $this->pageTitle(htmlspecialchars($this->product['title']) . '<i class="iconfont icon-angle-right"></i> 信息块'); goto MaPcs; QD0xp: $this->setGridPageUrlParam(array('productId' => $this->productId)); goto gvNXf; X7oar: $this->product = ModelUtil::get('tracking_product', $this->productId); goto sCpOK; MaPcs: } protected function crud(AdminCRUDBuilder $P0Vsm) { $P0Vsm->init('tracking_product_section')->field(function ($P0Vsm) { $P0Vsm->id('id', 'ID'); $P0Vsm->text('title', '名称')->required(); $P0Vsm->richHtml('content', '内容')->required()->help('<a href="javascript:;" data-dialog-request="' . modstart_admin_url('tracking/param') . '"><i class="iconfont icon-code"></i> 可用变量</a>'); $P0Vsm->display('created_at', L('Created At'))->listable(false); $P0Vsm->display('updated_at', L('Updated At'))->listable(false); })->repositoryFilter(function (RepositoryFilter $roX32) { $roX32->where('productId', $this->productId); })->hookSaved(function (Form $ypG_B) { $lDvaK = $ypG_B->item(); ModelUtil::update('tracking_product_section', $lDvaK->id, array('productId' => $this->productId)); })->hookDeleting(function (Form $ypG_B) { $ypG_B->item()->each(function ($lDvaK) { }); })->defaultOrder(array('sort', 'asc'))->canSort(true)->title('信息块管理'); } }