Skip to content

Commit 82c163e

Browse files
committed
Make compatible with Laravel 7
1 parent 762a1f4 commit 82c163e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Support/Str.php

+12
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,16 @@ public static function firstLetter(string $value): string
1212
{
1313
return mb_substr($value, 0, 1);
1414
}
15+
16+
/**
17+
* This method can be removed if we ever remove support for Laravel 7.*.
18+
*/
19+
public static function squish($value)
20+
{
21+
if (method_exists(BaseStr::class, 'squish')) {
22+
return parent::squish($value);
23+
}
24+
25+
return preg_replace('/\s+/', ' ', trim($value));
26+
}
1527
}

0 commit comments

Comments
 (0)