Laravel Change default routing behaviour in Laravel 5.2.31 +

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • public function map(Router $router) // Define the routes for the application.
  • protected function mapWebRoutes(Router $router) // Define the "web" routes for the application.

Parameters

ParameterHeader
Router $router\Illuminate\Routing\Router $router

Remarks

Middleware means that every call to a route will go through the middleware before actually hitting your route specific code. In Laravel the web middleware is used to ensure session handling or the csrf token check for example.

There are other middlewares like auth or api by default. You can also easily create your own middleware.



Got any Laravel Question?