Search code examples
phplaravellaravel-5laravel-5.5

Validate UUID with Laravel Validation


Is there a built-in way to validate UUID with a validation rule? I did not found anything about this in the "Available Validation Rules" documentation.


Solution

  • Actually, Laravel 5.7 supports UUID validation.

    $validation = $this->validate($request, [
        'uuid_field' => 'uuid'
    ]);
    

    Based on documentation.

    Just a note, it is not working in earlier 5.7 subversions, but for sure working since 5.7.28.