Laravel 5 how to separate user access with middleware

This tutorial I want to show you how to manage user authorization base on its own role by using middleware in laravel 5. For example, if you want to separate access between Admin and User role, so each of them can only access their own tasks. User cannot access Admin, and Admin cannot access User.

Note: Suppose that your default laravel authentication is working.

Step 1: Add role field to users table

Make sure you add column "role" in users table. And its value should store Admin or User.

Step 2: Change redirect after login

Please go to /app/Http/Controllers/Auth/LoginController.php. and change $redirectTo value to "/"