<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Partner\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminConfigBuilder; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use ModStart\Widget\ButtonDialogRequest; use Module\Partner\Type\PartnerPosition; use Module\Partner\Util\PartnerUtil; class PartnerController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $enw1u) { $enw1u->init('partner')->field(function ($enw1u) { $enw1u->id('id', 'ID'); $enw1u->select('position', '位置')->optionType(PartnerPosition::class); $enw1u->text('title', '名称'); $enw1u->image('logo', 'Logo'); $enw1u->text('link', '链接'); $enw1u->switch('enable', '启用')->gridEditable(true)->defaultValue(true); $enw1u->display('created_at', L('Created At'))->listable(false); $enw1u->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $zBPGV) { $zBPGV->eq('position', '位置')->select(PartnerPosition::class); $zBPGV->like('title', L('Title')); })->gridOperateAppend(ButtonDialogRequest::make('primary', '<i class="iconfont icon-cog"></i> 功能设置', modstart_admin_url('partner/config'))->size('big'))->enablePagination(false)->defaultOrder(array('sort', 'asc'))->canSort(true)->title('友情链接')->hookSaved(function (Form $hUMbi) { PartnerUtil::clearCache(); }); } public function config(AdminConfigBuilder $enw1u) { goto FXaPF; EJO5b: $enw1u->text('Partner_Title', '友情链接标题')->defaultValue('合伙伙伴'); goto z4Riv; z4Riv: $enw1u->switch('Partner_LinkDisable', '友情链接不跳转'); goto a105N; a105N: $enw1u->formClass('wide'); goto uh2ew; uh2ew: return $enw1u->perform(); goto N0Zt3; QXlmi: $enw1u->pageTitle('友情链接设置'); goto EJO5b; FXaPF: $enw1u->useDialog(); goto QXlmi; N0Zt3: } }