Q:

Non English slug for October cms blog

Using build 422 of October cms and Rainlab blog plugin, it's impossible to have a non English slug for blog post, every time it says "The slug format is invalid."
Is there any solution or workaround to resolve this limitation?

A:

You can comment on the below code in your model file like way.
Path :: Plugins/rainlab/blog/models/Post.php
 public $rules = [
        'title' => 'required',
        // 'slug' => ['required', 'regex:/^[a-z0-9\/\:_\-\*\[\]\+\?\|]*$/i', 'unique:rainlab_blog_posts'],
        'content' => 'required',
        'excerpt' => ''
    ];

A:

I would recommend you follow the extending guide of octobercms and extend it.
That way you can safely update the Blog plugin without having to worry about re-editing it again, or when you have to reinstall octobercms having to remember to edit it.
use Rainlab\Blog\Models\Post;

class Plugin extends PluginBase 
{
    public function boot()
    { 
        // Extend post Model
        Post::extend(function($model) {
            // Only do stuff when validation is triggered
            $model->bindEvent('model.beforeValidate', function() use ($model) {
                 // Find the regex holding value to avoid hardcoding array index
                 foreach($model->rules as $key => $value) {
                     if(strpos($value, 'regex:') !== false) {
                          // unset validation rule containing the regex.
                          unset($model->rules[$key]);
                          break;
                     }
                 }
            }
        });
    }
}

