Skip to content

Commit 672528e

Browse files
authored
Add whereUlid(param) support for routing (#45372)
1 parent ca775d0 commit 672528e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public function whereNumber($parameters)
3939
return $this->assignExpressionToParameters($parameters, '[0-9]+');
4040
}
4141

42+
/**
43+
* Specify that the given route parameters must be ULIDs.
44+
*
45+
* @param array|string $parameters
46+
* @return $this
47+
*/
48+
public function whereUlid($parameters)
49+
{
50+
return $this->assignExpressionToParameters($parameters, '[0-7][0-9a-hjkmnp-tv-zA-HJKMNP-TV-Z]{25}');
51+
}
52+
4253
/**
4354
* Specify that the given route parameters must be UUIDs.
4455
*

src/Illuminate/Support/Facades/Route.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
* @method static \Illuminate\Routing\RouteRegistrar whereAlpha(array|string $parameters)
8484
* @method static \Illuminate\Routing\RouteRegistrar whereAlphaNumeric(array|string $parameters)
8585
* @method static \Illuminate\Routing\RouteRegistrar whereNumber(array|string $parameters)
86+
* @method static \Illuminate\Routing\RouteRegistrar whereUlid(array|string $parameters)
8687
* @method static \Illuminate\Routing\RouteRegistrar whereUuid(array|string $parameters)
8788
* @method static \Illuminate\Routing\RouteRegistrar whereIn(array|string $parameters, array $values)
8889
* @method static \Illuminate\Routing\RouteRegistrar as(string $value)

0 commit comments

Comments
 (0)