mercredi 30 septembre 2015

Laravel routes accepts only specific format

I'm using laravel 5.1 and I would like to know if I could only allow specific route format in my routes.php?

The route format should look like this (strict):

http://ift.tt/1O8KDAk

Wherein 2015-09 is year-month. It should only accept this format (as stated above). Having a different format will only redirect to the homepage. Example:

http://ift.tt/1O8KA7E
http://ift.tt/1QLIZSF
http://ift.tt/1QLJ20H
http://ift.tt/1QLJ20J
http://ift.tt/1QLIZSH

So in my routes I have this:

Route::get('archive/{date}', 'ArchiveController@index');

I saw on the documentation that regular expressions could be used but I'm not sure how would I be able to do it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire