<?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 $P2vse) { $P2vse->init('partner')->field(function ($P2vse) { $P2vse->id('id', 'ID'); $P2vse->select('position', '位置')->optionType(PartnerPosition::class); $P2vse->text('title', '名称'); $P2vse->image('logo', 'Logo'); $P2vse->text('link', '链接'); $P2vse->switch('enable', '启用')->gridEditable(true)->defaultValue(true); $P2vse->display('created_at', L('Created At'))->listable(false); $P2vse->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $mHisM) { $mHisM->eq('position', '位置')->select(PartnerPosition::class); $mHisM->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 $NX6uw) { PartnerUtil::clearCache(); }); } public function config(AdminConfigBuilder $P2vse) { goto d7YI7; eDSMb: $P2vse->switch('Partner_LinkDisable', '友情链接不跳转'); goto z1Egn; eXHsV: $P2vse->pageTitle('友情链接设置'); goto xL6Eq; xL6Eq: $P2vse->text('Partner_Title', '友情链接标题')->defaultValue('合伙伙伴'); goto eDSMb; d7YI7: $P2vse->useDialog(); goto eXHsV; z1Egn: $P2vse->formClass('wide'); goto n2jJi; n2jJi: return $P2vse->perform(); goto BQdDh; BQdDh: } }