lundi 1 janvier 2018

How to Create a pattern for URL parameters in Laravel

I wrote this code in file RouteServiceProvider.php that is located in app/Providers directory. in method boot:

$this->pattern('{id}', '[0-9]+');

then according to what I read, I thought if I write this code:

Route::get('/user/{id}', function ($id){ return $id; });

in file web.php in routes directory the id parameter accept just int value, but when i test this url: http://ift.tt/2ly1KlU I saw a is returned. Now the question is:

  1. where is the problem?

2.how can I make pattern?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lAew2t
via IFTTT

Aucun commentaire:

Enregistrer un commentaire