'require|checkAssetInfo', 'name' => 'require|length:1,255', 'images' => 'require', 'address' => 'require', 'contacts' => 'require', 'mobile' => 'require', 'status' => 'in:0,1', ]; protected $message = [ 'id.require' => '资产id必传', 'name.require' => '资产名称不能为空', 'name.length' => '资产名称长度须在1-255位字符', 'images.require' => '资产图片不能为空', 'address.require' => '资产地址不能为空', 'contacts.require' => '资产联系人不能为空', 'mobile.require' => '联系方式不能为空', ]; /** * @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']); } /** * @notes 更改状态场景 * @return ArticleValidate * @author heshihu * @date 2022/2/22 10:18 */ public function sceneStatus() { return $this->only(['id', 'status']); } 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 = AssetInfo::findOrEmpty($value); if ($article->isEmpty()) { return '资产不存在'; } return true; } }