1//above in controller
2use Illuminate\Support\Str;
3
4//in function
5$uuid = Str::uuid()->toString();
6
7//terminal
8composer require "webpatser/laravel-uuid:^3.0"
1use Illuminate\Support\Str;
2
3$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de');
4
5// true
6
7$isUuid = Str::isUuid('laravel');
8
9// false