'require|checkPopup', 'name' => 'require|length:1,120', 'page_path' => 'require|length:1,255', 'popup_type' => 'require|in:1,2,3', 'link_type' => 'require|in:0,1,2,3', 'frequency' => 'require|in:1,2,3,4', 'status' => 'require|in:0,1', 'delay_seconds' => 'egt:0', 'is_closable' => 'in:0,1', 'sort' => 'egt:0', ]; protected $message = [ 'id.require' => '弹窗ID不能为空', 'name.require' => '弹窗名称不能为空', 'page_path.require' => '页面路径不能为空', 'popup_type.require' => '弹窗类型不能为空', 'link_type.require' => '跳转类型不能为空', 'frequency.require' => '弹窗频率不能为空', ]; public function sceneAdd() { return $this->remove('id', true); } public function sceneEdit() { } public function sceneDelete() { return $this->only(['id']); } public function sceneDetail() { return $this->only(['id']); } public function sceneStatus() { return $this->only(['id', 'status']); } public function checkPopup($value) { $exist = PagePopup::findOrEmpty($value); if ($exist->isEmpty()) { return '弹窗不存在'; } return true; } }