'require|checkAssetInfo', 'title' => 'require|length:1,50', ]; protected $message = [ 'id.require' => '资产地址id必传', 'title.require' => '地址名称不能为空', 'title.length' => '地址名称长度须在1-55位字符', ]; /** * @notes 添加场景 * @return ArticleValidate * @author heshihu * @date 2022/2/22 9:57 */ public function sceneAdd() { return $this->remove(['id']) ->remove('id','require|checkAssetInfo'); } /** * @notes 详情场景 * @return ArticleValidate * @author heshihu * @date 2022/2/22 10:15 */ public function sceneDetail() { return $this->only(['id']); } public function sceneEdit() { } /** * @notes 删除场景 * @return ArticleValidate * @author heshihu * @date 2022/2/22 10:17 */ public function sceneDelete() { return $this->only(['id']); } /** * @notes 检查指定地址是否存在 * @param $value * @return bool|string * @author heshihu * @date 2022/2/22 10:11 */ public function checkAssetInfo($value) { $article = AssetArea::findOrEmpty($value); if ($article->isEmpty()) { return '地址不存在'; } return true; } }