I recently had the need to pass parameters to middleware for authentication purposes. I wanted to declare a custom role for each route, have that role passed to the middleware, and if the user held that role the route would pass. The solution actually turned out to be quite simple and using a solution I found for Laravel 4 I was able to make this work for Laravel 5. In particular I made this solution for use with Cartalyst Sentry, but can be easily adapted to work with any use. First things first, let's create a simple middleware. We will call this RoleChecker and save it to the Http\Middleware directory. Note that you will need to change the "YourAppNameHere" name to work with your installation. [crayon-5def6f4f937e5207099958/] Now we need Laravel to recognize our custom middleware so we open the Http/Kernel.php file and add the following line to the $routeMiddleware array: [crayon-5def6f4f937eb607129331/] Finally, we can start passing parameters to our … [Read more...] about Pass parameters to middleware in Laravel 5