Adding routes in Laravel project
For adding routes in routes.php we need to add different routes with their equivalent view that is returned or some random text that we want to return. In the following example we are adding some routes with their random text that is returned after entering request in browsers.
Example
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ // will return 'Hello project root' on browser request /laravel/public Route::get('/', function() { return "Hello project root"; }); // will return 'Hello abc/abc1' on browser request /laravel/public/abc/abc1 Route::get('abc/abc1', function() { return 'Hello abc/abc1'; }); // will return 'Hello abc/abc2' on browser request /laravel/public/abc/abc2 Route::get('abc/abc2', function() { return 'Hello abc/abc2'; }); //will return 'Hello xyz/xyz1' on browser request /laravel/public/xyz/xyz1 Route::get('xyz/xyz1', function() { return 'Hello xyz/xyz1'; }); //will return 'Hello xyz/xyz2' on browser request /laravel/public/xyz/xyz2 Route::get('xyz/xyz2', function() { return 'Hello xyz/xyz2'; });