<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Photo\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\Photo\Type\PhotoCategoryType; use Module\Photo\Type\PhotoCategoryVisitType; use Module\Photo\Util\PhotoCategoryUtil; class PhotoCategoryController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $a1cww) { $a1cww->init('photo_category')->field(function ($a1cww) { $a1cww->id('id', 'ID'); $a1cww->text('name', '名称'); $a1cww->image('cover', '封面'); $a1cww->radio('type', '类别')->optionType(PhotoCategoryType::class)->when('=', PhotoCategoryType::VIDEO, function ($a1cww) { $a1cww->video('videoUrl', '视频'); }); $a1cww->radio('visitType', '访问权限')->optionType(PhotoCategoryVisitType::class)->when('=', PhotoCategoryVisitType::VISIT_PASSWORD, function ($a1cww) { $a1cww->text('visitPass', '访问密码'); }); $a1cww->display('created_at', L('Created At'))->listable(false); $a1cww->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $q81IC) { $q81IC->eq('id', L('ID')); $q81IC->like('name', '名称'); })->hookChanged(function (Form $ukDy3) { PhotoCategoryUtil::clearCache(); })->title('相册集')->asTree('id', 'pid', 'sort', 'name')->treeMaxLevel(1); } }