<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Faka\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\Response; use ModStart\Core\Util\CRUDUtil; use ModStart\Field\AbstractField; use ModStart\Field\Type\FieldRenderMode; use ModStart\Form\Form; use ModStart\Grid\Displayer\ItemOperate; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use ModStart\Widget\TextAjaxRequest; use Module\CitySite\Util\CitySiteAreaUtil; use Module\Faka\Constant\FakaConstant; use Module\Faka\Type\ProductDeliverType; use Module\Faka\Type\WorkStatus; use Module\Faka\Util\FakaProductUtil; use Module\Faka\Util\WorkUtil; use Module\Member\Util\MemberFavoriteUtil; class ProductController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $A2Tuf) { $A2Tuf->init('faka_product')->field(function ($A2Tuf) { $A2Tuf->id('id', 'ID'); $A2Tuf->select('categoryId', '分类')->optionModelTree('faka_product_category'); $A2Tuf->text('title', '名称'); $A2Tuf->image('cover', '封面'); $A2Tuf->number('stock', '库存'); $A2Tuf->decimal('price', '价格'); $A2Tuf->type('deliverType', '发送方式')->type(ProductDeliverType::class); for ($qzlby = 1; $qzlby <= 5; $qzlby++) { $A2Tuf->customField('customField' . $qzlby, '自定义字段' . $qzlby); } $A2Tuf->richHtml('content', '内容'); $A2Tuf->display('created_at', L('Created At')); $A2Tuf->display('updated_at', L('Updated At')); })->gridFilter(function (GridFilter $cbHm3) { $cbHm3->eq('id', L('ID')); $cbHm3->like('title', '标题'); })->hookDeleted(function (Form $OkcU0) { $OkcU0->item()->each(function ($vPOhn) { FakaProductUtil::delete($vPOhn->id); }); })->title('商品管理'); } }