Laravel – Routing

 Basic Routing

Basic routing is meant to route your request to an appropriate controller. The routes of the application can be defined in the app/Http/routes.php file. Here is the general route syntax for each of the possible requests.

Route::get('/', function () {

 return 'Hello World';

 });

 Route::post('foo/bar', function () {

 return 'Hello World'; 

}); 

Route::put('foo/bar', function () { 

 // 

}); 

Route::delete('foo/bar', function () {

 //

 }); 

Example:

app/Http/routes.php

<?php

Route::get('/', function () {

 return view('welcome');

}); 

The routing mechanism is depicted in the following image: 





Comments