12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\admin\validate\life;
- use think\Validate;
- class FarmGoodsValidate extends Validate
- {
- protected $rule = [
- 'goods_name' => 'require|max:100',
- 'goods_img' => 'require',
- 'food_silde' => 'require',
- 'goods_category_id' => 'require',
- 'goods_shop_id' => 'require',
- 'goods_is_new' => 'require',
- 'goods_price' => 'require',
- 'goods_content' => 'require',
- 'goods_sell_num' => 'require',
- 'goods_postage_id' => 'require',
- 'goods_status' => 'require',
- 'goods_weight' => 'require',
- 'food_storage' => 'require',
- 'food_packaging' => 'require',
- 'food_varieties' => 'require',
- 'food_attr' => 'require',
- 'goods_sort' => 'require',
- 'goods_create_time' => 'require',
- 'goods_update_time' => 'require',
- ];
- protected $message = [
- 'goods_name' => '商品名不能为空',
- 'goods_img' => '商品图不能为空',
- 'food_silde' => '轮播图不能为空',
- 'goods_category_id' => '所属分类不能为空',
- 'goods_shop_id' => '所属店铺不能为空',
- 'goods_is_new' => 'goods_is_new不能为空',
- 'goods_price' => '价格不能为空',
- 'goods_content' => '详情不能为空',
- 'goods_sell_num' => '销量不能为空',
- 'goods_postage_id' => '运费模板不能为空',
- 'goods_status' => '状态不能为空',
- 'goods_weight' => '重量不能为空',
- 'food_storage' => '储存方式不能为空',
- 'food_packaging' => '包装方式不能为空',
- 'food_varieties' => '品种不能为空',
- 'food_attr' => '规格不能为空',
- 'goods_sort' => '排序不能为空',
- 'goods_create_time' => '创建时间不能为空',
- 'goods_update_time' => '更新时间不能为空',
- ];
- //场景
- protected $scene = [
- 'create' => ['goods_name','goods_img','food_silde','goods_category_id','goods_shop_id','goods_is_new','goods_price','goods_content','goods_postage_id','goods_weight','goods_sort'],
- 'update' => ['goods_id'],
- 'info' => ['goods_id']
- ];
- }
|