I try to filter my route like following :
Route::post('/vote/{bandId}', 'VoteController@vote')->where('bandId', '[0-9]+');
But it allows the following route :
http://localhost/vote/0
Which I do not want since I am fetching the resource from a query by filtering on the auto-increment field (which is greater than 0).
I tryied to type an advanced regex like I would do with preg_match()
:
Route::post('/voter/{bandId}', 'VoteController@vote')->where('bandId', '[1-9][0-9]*');
Which let numbers between 1 and infinite.
Question
This last route does not works, how can I come with a complex regular expression to check the integrity of my wildcard before fetching the resource in my database ?