Editing files in vendor is not recommended. These changes are reset on every composer action, including those by the extension manager.
Luckily Flarum has an extender to change validation classes, you can make these changes in the extend.php
in the root of your Flarum installation:
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Extend;
use Flarum\Discussion\DiscussionValidator;
use Illuminate\Validation\Validator;
return [
(new Extend\Validator(DiscussionValidator::class))->configure(function (DiscussionValidator $validator, Validator $illuminate) {
$rules = $validator->getRules()['title'];
$rules[] = 'regex:~^[\w ]+$~';
$validator->addRules(['title' => $rules]);
}),
];
You might need to adapt the regex, see: https://www.phpliveregex.com/p/MDm