avinash shows us how to use Middleware for content restriction based on user role.

laravel content

Hello everyone, welcome back to justlaravel.com. Here in this post, I am going to show you how to use Middleware in your laravel applications to restrict content or some specific pages based on user role. This comes very handy when you have a simple paid membership site with where users who pay for a subscription can see pages which are not visible by other users. Or if you have admin, user, super admin type of roles, then also this Middleware in laravel works well.

Lets break down this into the following parts.

  • Setup User Roles
  • Middleware for specific roles
  • Views and Controllers for Middleware

Original Post: http://justlaravel.com/middleware-laravel-content-restriction-user-role/

Working demo: http://demos.justlaravel.com/middleware-laravel-content-restriction-user-role/

GitHub: https://github.com/avinashn/middleware-laravel-example