jeudi 3 mars 2016

How to add regex modifier to Laravel 5.1 route where constraint?

I am trying to add a where constraint to a route like the following:

Route::get('{franchise}', ['as' => 'franchise.home', 'uses' => 'FranchiseController@home'])
->where('franchise', 'ford|nissan|mazda|skoda|kia');

I want the car manufacturers to be case insensitive, so that it would match FORD, Ford, ford, forD.

I have tried the following to no avail:

->where('franchise', 'ford|nissan|mazda|skoda|kia/i');
->where('franchise', '/ford|nissan|mazda|skoda|kia/i');

Is it even possible to add regex modifiers to this where constraint on a route?



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

Aucun commentaire:

Enregistrer un commentaire