添加数据验证
This commit is contained in:
parent
e3beb860d3
commit
a0c2eaaf53
@ -48,7 +48,7 @@ class DishesLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
$dishesCategoryIds = DishesCategory::where('id', $this->params['dishes_category_id'])->whereOr('pid', $this->params['dishes_category_id'])->column('id');
|
||||
$query->whereIn('dishes_category_id', $dishesCategoryIds);
|
||||
}
|
||||
return $query->field(['id', 'name', 'dishes_category_id', 'create_time'])
|
||||
return $query->field(['id', 'name', 'dishes_category_id', 'create_time', 'image', 'intro'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
|
@ -30,6 +30,8 @@ class DishesLogic extends BaseLogic
|
||||
try {
|
||||
Dishes::create([
|
||||
'name' => $params['name'],
|
||||
'image' => $params['image'],
|
||||
'intro' => $params['intro'],
|
||||
'dishes_category_id' => $params['dishes_category_id'],
|
||||
]);
|
||||
|
||||
@ -56,6 +58,8 @@ class DishesLogic extends BaseLogic
|
||||
try {
|
||||
Dishes::where('id', $params['id'])->update([
|
||||
'name' => $params['name'],
|
||||
'image' => $params['image'],
|
||||
'intro' => $params['intro'],
|
||||
'dishes_category_id' => $params['dishes_category_id'],
|
||||
]);
|
||||
|
||||
@ -93,4 +97,4 @@ class DishesLogic extends BaseLogic
|
||||
{
|
||||
return Dishes::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,82 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Dishes验证器
|
||||
* Class DishesValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class DishesValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Dishes验证器
|
||||
* Class DishesValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class DishesValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'dishes_category_id' => 'require',
|
||||
'image' => 'require',
|
||||
'intro' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '名称',
|
||||
'dishes_category_id' => '菜品分类id',
|
||||
'image' => '图片',
|
||||
'intro' => '简介',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'dishes_category_id', 'name', 'image', 'intro']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return DishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProductCategory验证器
|
||||
* Class ProductCategoryValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductCategoryValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProductCategory验证器
|
||||
* Class ProductCategoryValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductCategoryValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'pid' => 'require',
|
||||
'name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'pid' => '上级',
|
||||
'name' => '名称',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'pid', 'name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductCategoryValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProductUnit验证器
|
||||
* Class ProductUnitValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductUnitValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProductUnit验证器
|
||||
* Class ProductUnitValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductUnitValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'conversion_value' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '名称',
|
||||
'conversion_value' => '换算值',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductUnitValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Product验证器
|
||||
* Class ProductValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Product验证器
|
||||
* Class ProductValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'category_id' => 'require',
|
||||
'unit_id' => 'require',
|
||||
'name' => 'require',
|
||||
'image' => 'require',
|
||||
'intro' => 'require',
|
||||
'conent' => 'require',
|
||||
'product_type' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'category_id' => '分类',
|
||||
'unit_id' => '单位',
|
||||
'name' => '名称',
|
||||
'image' => '图片',
|
||||
'intro' => '简介',
|
||||
'conent' => '内容',
|
||||
'product_type' => '商品类型',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'category_id', 'unit_id', 'name', 'image', 'intro', 'conent', 'product_type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/11 11:41
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProjectDishesProduct验证器
|
||||
* Class ProjectDishesProductValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectDishesProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProjectDishesProduct验证器
|
||||
* Class ProjectDishesProductValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectDishesProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'project_id' => 'require',
|
||||
'dishes_id' => 'require',
|
||||
'product_id' => 'require',
|
||||
'unit_id' => 'require',
|
||||
'nums' => 'require',
|
||||
'consume_time' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'project_id' => '项目ID',
|
||||
'dishes_id' => '菜品ID',
|
||||
'product_id' => '商品ID',
|
||||
'unit_id' => '单位ID',
|
||||
'nums' => '数量',
|
||||
'consume_time' => '食用时间',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'project_id', 'dishes_id', 'product_id', 'unit_id', 'nums', 'consume_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectDishesProductValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProjectDishes验证器
|
||||
* Class ProjectDishesValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectDishesValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* ProjectDishes验证器
|
||||
* Class ProjectDishesValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectDishesValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'project_id' => 'require',
|
||||
'dishes_id' => 'require',
|
||||
'consume_time' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'project_id' => '项目ID',
|
||||
'dishes_id' => '菜品ID',
|
||||
'consume_time' => '食用时间',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id', 'project_id', 'dishes_id', 'consume_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectDishesValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,82 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Project验证器
|
||||
* Class ProjectValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* Project验证器
|
||||
* Class ProjectValidate
|
||||
* @package app\admin\validate
|
||||
*/
|
||||
class ProjectValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'address' => 'require',
|
||||
'start_time' => 'require',
|
||||
'end_time' => 'require',
|
||||
'linkman' => 'require',
|
||||
'contacts_dept' => 'require',
|
||||
'contact_number' => 'require',
|
||||
'area_manager_id' => 'require',
|
||||
'project_status' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '名称',
|
||||
'address' => '地址',
|
||||
'start_time' => '开始时间',
|
||||
'end_time' => '结束时间',
|
||||
'linkman' => '联系人',
|
||||
'contacts_dept' => '联系部门',
|
||||
'contact_number' => '联系电话',
|
||||
'area_manager_id' => '区域经理',
|
||||
'project_status' => '项目状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'name', 'address', 'start_time', 'end_time', 'linkman', 'contacts_dept', 'contact_number', 'area_manager_id', 'project_status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ProjectValidate
|
||||
* @author likeadmin
|
||||
* @date 2025/07/16 15:09
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user