Create Middleware in Laravel 5

How to create a new middleware

Laravel 5 included a new feature middleware, Which does not let entering within app until user passed several conditions. creating a middleware which allow users to download files.