Validating routes in Lumen

Asked

Viewed 215 times

3

In the Laravel have for example:

Route::get( '/produtos/mostra/{id}', 
    'ProdutoController@mostra' 
)->where('id', '[0-9]+');

How this kind of validation would be done in the Lumen? Given that a route is originated by $app:

$app->get('insert', function () {

});
  • It didn’t work to put the where in the end too ?

  • @Zooboomafoo no, makes the mistake: Call to undefined method Laravel\Lumen\Application::where()

  • But you have to be negative ? I’m trying to help you.

  • @Zooboomafoo It is because with almost 10K of reputation you should know that the answer field was not made to debate the question, for that there are comments. As much as I want to help, I have to follow the rules here. With the edition you made worked, I’ll put +1, thanks, and I hope you understand why the negative before.

1 answer

2


Do so according to the Documentation.

$app->get('/produtos/mostra/{id:[0-9]+}', 'ProdutoController@mostra');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.