Middleware for localization

Creating a middleware file

Add middleware to app/Http/Kernel.php

Apply middleware in route.php

Middleware

Note

  1. Constructor of a controller will be execute before route, middleware and session.

Reference

  1. https://laravel.com/docs/5.4/middleware