具有角色和权限的多重身份验证

时间:2018-09-01 01:12:10

标签: laravel

我有4个单独的部分作为登录名

管理员登录 供应商登录 员工登录 用户登录

管理员应该为这些不同类型的用户创建所有角色和权限

我应该如何维护角色和权限表

我只能有两个表,例如角色和权限来管理所有这些用户类型

1 个答案:

答案 0 :(得分:-1)

  yes you have to create four tables.1 permissions,2 permission_roles,3 users and 4 user_roles table.
    for define role you can use this code in login function.i hope it will help you.
     if (isset($_SESSION['user']['user_id'])) {
                if ($_SESSION['user']['group_slug'] == 'Admin') {
                    return redirect('admin/dashboard');
                } else if ($_SESSION['user']['group_slug'] == 'Vendor') {
                  return redirect('Vendor/dashboard');
                } else if ($_SESSION['user']['group_slug'] == 'Employee') {
                      return redirect('Employee/dashboard');
                } else if ($_SESSION['user']['group_slug'] == 'User') {
                 return redirect('User/dashboard');
                }
            }
相关问题