['规则1','规则2'...] * * @var array */ protected $rule = [ 'id' => 'require|integer', 'link' => 'url|max:255', 'platform_id' => 'integer' ]; /** * 定义错误信息 * 格式:'字段名.规则名' => '错误信息' * * @var array */ protected $message = [ 'id.require' => 'id不能为空', 'id.integer' => 'id字段类型错误', 'link.url' => '链接格式不正确', 'link.max' => '链接不能超过255个字符', 'platform_id.integer' => '平台id类型错误' ]; /** * 更新场景 */ public function sceneUpdate() { return $this->only(['id', 'link', 'platform_id'])->remove('id', 'require'); } }