diff --git a/src/core/Slugify/CodeSlugify.php b/src/core/Slugify/CodeSlugify.php index f01ff23..fc900f4 100644 --- a/src/core/Slugify/CodeSlugify.php +++ b/src/core/Slugify/CodeSlugify.php @@ -11,18 +11,12 @@ use Cocur\Slugify\Slugify as BaseSlugify; */ class CodeSlugify extends Slugify { - public function slugify($data): ?string - { - $slug = parent::slugify($data); - - return preg_replace('/[^\w]+/', '', $slug); - } - protected function create(): BaseSlugify { $slugify = new BaseSlugify([ 'separator' => '_', 'lowercase' => true, + 'regexp' => '/[^A-Za-z0-9_]+/', ]); $slugify->activateRuleSet('french'); diff --git a/src/core/Slugify/RouteParameterSlugify.php b/src/core/Slugify/RouteParameterSlugify.php index 7b65bbc..5500b89 100644 --- a/src/core/Slugify/RouteParameterSlugify.php +++ b/src/core/Slugify/RouteParameterSlugify.php @@ -11,18 +11,13 @@ use Cocur\Slugify\Slugify as BaseSlugify; */ class RouteParameterSlugify extends Slugify { - public function slugify($data): ?string - { - $slug = parent::slugify($data); - - return preg_replace('/[^\w]+/', '', $slug); - } - protected function create(): BaseSlugify { $slugify = new BaseSlugify([ 'separator' => '_', 'lowercase' => false, + 'trim' => false, + 'regexp' => '/[^A-Za-z0-9_]+/', ]); $slugify->activateRuleSet('french');