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