/** * This function used to save permission matrix */ public function savePermissionMatrix(Request $request) { access_check('manage_permission_matrix'); RolePermissions::truncate(); $permission_matrix = $request->input('pm'); if (count($permission_matrix) > 0) { foreach ($permission_matrix as $permission) { $piece = explode('_', $permission); RolePermissions::create(array('pid' => $piece[0], 'rid' => $piece[1])); } } Session::flash('success', 'Permission Matrix Saved successfully.'); return redirect('admin/permissionMatrix'); }
public function run() { \Focalworks\Users\RolePermissions::create(['rid' => 2, 'pid' => 2]); \Focalworks\Users\RolePermissions::create(['rid' => 3, 'pid' => 2]); }