Working with To Routing In Laravel 5.4

Submitted by azazqadir - 2 months ago

Route is a way of creating a request URL of your application. These URL do not have to map to specific files on website. The best thing about these URL is that they are both human readable and SEO friendly. In Laravel 5.4, routes are created inside the routes folder. Routes for the website are created in web.php file, Similarly, the routes for the API are created inside api.php. Source: https://www.cloudways.com/blog/routing-in-laravel-5-4/

Route::get('/table/{number?}', function ($number = 2) {

   for($i =1; $i <= 10 ; $i++){

       echo "$i * $number = ". $i* $number ."<br>";

   }   

});
comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks