<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Nav\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\Nav\Type\NavPosition; use Module\Nav\Util\NavUtil; class NavController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $NXyDB) { $NXyDB->init('nav')->field(function ($NXyDB) { $NXyDB->id('id', 'ID'); $NXyDB->select('position', '位置')->optionType(NavPosition::class); $NXyDB->text('name', '名称'); $NXyDB->link('link', '链接'); $NXyDB->display('created_at', L('Created At'))->listable(false); $NXyDB->display('updated_at', L('Updated At'))->listable(false); })->gridFilder(function (GridFilter $EFNvu) { $EFNvu->eq('position', '位置')->select(NavPosition::class); })->enablePagination(false)->defaultOrder(array('sort', 'asc'))->canSort(true)->title('导航')->hookSaved(function (Form $EmQdh) { NavUtil::clearCache(); }); } }