Situation where I came across: Consider the following cases :
Route::pattern()
or we can useRoute::({method}/{keyword})->where('keyword', {regex});
- Validation Rule
array( 'keyword' => "/^{regex}$/");
Both accepts different format of regex
in case 1: Route::pattern()
or in Route::()->where()
it does not accept regex in /^{regex}$/ format. It only accepts Route::pattern('keword', {regex})
.
in case 2: its accepts regex in /^{regex}$/
pattern.
So in short, I can't apply the same in both place. That is why I have to write two different regex, however they are same.
Am I missing something? Is that possible that model regex and route pattern regex can be defined at once? So changing one regex, we dont have to change another one. Just because of /^$/ ?