Skip to content

Commit 435f155

Browse files
[12.x] Document version-specific UUID string validation (#10680)
* Document version-specific UUID string validation * Update strings.md * Update strings.md --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 797b4db commit 435f155

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

strings.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,20 @@ $isUuid = Str::isUuid('laravel');
889889
// false
890890
```
891891

892+
You may also validate that the given UUID matches a UUID specification by version (1, 3, 4, 5, 6, 7, or 8):
893+
894+
```php
895+
use Illuminate\Support\Str;
896+
897+
$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', version: 4);
898+
899+
// true
900+
901+
$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', version: 1);
902+
903+
// false
904+
```
905+
892906
<a name="method-kebab-case"></a>
893907
#### `Str::kebab()` {.collection-method}
894908

0 commit comments

Comments
 (0)