Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex with laravel-hyrule #1

Closed
RenatoKW opened this issue May 4, 2022 · 2 comments
Closed

Regex with laravel-hyrule #1

RenatoKW opened this issue May 4, 2022 · 2 comments

Comments

@RenatoKW
Copy link

RenatoKW commented May 4, 2022

Is there a way to use regular expressions with this API? Haven't see any mentions in the documentation for this.
Ty

@bezhermoso
Copy link
Collaborator

Any and all built-in rules in Laravel is possible :) Just use the rule name as if it's a method in the builder, and it will be appended as a rule. For example, you can use regex like so:

$builder = Hyrule::create()
    ->string('slug')
       ->regex('/^[a-z0-9\-]$/')
       ->end()
    // etc.

@RenatoKW
Copy link
Author

RenatoKW commented May 4, 2022

Very Nice!! Thanks for the quick reply!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants