'require', 'user_id' => 'require', 'title' => 'require', 'total_area' => 'require', 'residual_area' => 'require', 'province_code' => 'require', 'province_name' => 'require', 'city_code' => 'require', 'city_name' => 'require', 'county_code' => 'require', 'county_name' => 'require', 'town_code' => 'require', 'town_name' => 'require', 'village_code' => 'require', 'village_name' => 'require', 'group_code' => 'require', 'group_name' => 'require', 'longitude' => 'require', 'latitude' => 'require', 'master_name' => 'require', 'master_phone' => 'require', ]; /** * 参数描述 * @var string[] */ protected $field = [ 'id' => 'id', 'user_id' => '用户id', 'title' => '土地名称', 'total_area' => '土地面积', 'residual_area' => '剩余面积', 'province_code' => '省编码', 'province_name' => '省名称', 'city_code' => '市编码', 'city_name' => '市名称', 'county_code' => '县编码', 'county_name' => '县名称', 'town_code' => '镇编码', 'town_name' => '镇名称', 'village_code' => '村编码', 'village_name' => '村名称', 'group_code' => '组编码', 'group_name' => '组名称', 'longitude' => '经度', 'latitude' => '纬度', 'master_name' => '土地负责人', 'master_phone' => '负责人电话', 'status' => '土地状态1-未种植 2-部分种植 3-全部种植', 'pic' => '土地图片', ]; /** * @notes 添加场景 * @return LandValidate * @author likeadmin * @date 2023/11/22 16:35 */ public function sceneAdd() { return $this->only(['user_id','title','master_name','master_phone']); } /** * @notes 编辑场景 * @return LandValidate * @author likeadmin * @date 2023/11/22 16:35 */ public function sceneEdit() { return $this->only(['id','user_id','title','master_name','master_phone']); } /** * @notes 删除场景 * @return LandValidate * @author likeadmin * @date 2023/11/22 16:35 */ public function sceneDelete() { return $this->only(['id'])->append('id', 'require|checkLand'); } /** * @notes 详情场景 * @return LandValidate * @author likeadmin * @date 2023/11/22 16:35 */ public function sceneDetail() { return $this->only(['id']); } public function checkLand($value, $rule, $data) { $landProduct = Db::name('land_product')->where('land_id', $value)->findOrEmpty(); if (!empty($landProduct)) { return '存在关联产品,无法删除'; } return true; } }