All routes in Laravel are defined in route files which are available in the routes directory. The routes/web.php file defines every route that is used for the web interface. These routes are assigned the all web middleware group, which gives features like CSRF protection and session state.

How we can use it?

Routes in Laravel 5 are located in routes directory and Laravel has basically 3 categories namely.

  • api.php
  • web.php
  • console.php

You can use php artisan route:list to check all available route lists. Examples are given below:-

BY Best Interview Question ON 17 Mar 2020


Route::get('/', function () {
    return view('welcomepage');