<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\CmsHelp\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use Module\CmsHelp\Core\CmsHelpSuperSearchBiz; class CmsHelpController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $kC4To) { $kC4To->init('cms_help')->field(function ($kC4To) { $kC4To->id('id', 'ID'); $kC4To->select('categoryId', '分类')->optionModelTree('cms_help_category', 'id', 'pid', 'name'); $kC4To->text('title', '名称'); $kC4To->textarea('summary', '摘要'); $kC4To->richHtml('content', '内容')->listable(false); $kC4To->display('created_at', L('Created At'))->listable(false); $kC4To->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $bWyIm) { $bWyIm->eq('id', L('ID')); $bWyIm->like('title', L('Title')); })->hookSaved(function (Form $l3dqy) { CmsHelpSuperSearchBiz::syncUpsert(array($l3dqy->item()->toArray())); })->hookDeleted(function (Form $l3dqy) { $l3dqy->item()->each(function ($kHxHl) { CmsHelpSuperSearchBiz::syncDelete($kHxHl->id); }); })->title('帮助内容'); } }