Commit 02e37460 by Alexander Makarov

Fixed Inflector::slug to work properly with numbers

parent 8f5a465d
......@@ -415,7 +415,7 @@ class BaseInflector
public static function slug($string, $replacement = '-', $lowercase = true)
{
$string = static::transliterate($string);
$string = preg_replace('/[^a-zA-Z=\s—–-]+/u', '', $string);
$string = preg_replace('/[^a-zA-Z0-9=\s—–-]+/u', '', $string);
$string = preg_replace('/[=\s—–-]+/u', $replacement, $string);
$string = trim($string, $replacement);
......
......@@ -126,7 +126,7 @@ class InflectorTest extends TestCase
{
$data = [
'' => '',
'hello world' => 'hello-world',
'hello world 123' => 'hello-world-123',
'remove.!?[]{}…symbols' => 'removesymbols',
'minus-sign' => 'minus-sign',
'mdash—sign' => 'mdash-sign',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment