Simple Basic Routing using Laravel

Basic Routing

Most of the routes for your application will be defined in the app/routes.php file. The simplest Laravel routes consist of a URI and a Closure callback.

Basic GET Route

Basic POST Route

Registering A Route For Multiple Verbs

Registering A Route Responding To Any HTTP Verb

Forcing A Route To Be Served Over HTTPS

Often, you will need to generate URLs to your routes, you may do so using the URL::to method:

Route Parameters

Optional Route Parameters

Optional Route Parameters With Defaults

Regular Expression Route Constraints

Passing An Array Of Wheres

Of course, you may pass an array of constraints when necessary:

 Defining Global Patterns

If you would like a route parameter to always be constrained by a given regular expression, you may use the pattern method:

 Accessing A Route Parameter Value

If you need to access a route parameter value outside of a route, you may use the Route::input method: