public function eliminarRol() { $rol = Input::get("rol"); $roles = Permisos::where("role_id", "=", $rol)->get(); if (count($roles) > 0) { return Response::json(array("estado" => "1")); } else { $role = Role::find($rol); $role->delete(); $permisos = Roles::find($rol); $permisos->delete(); $html = (string) View::make("dashboard.roles.rolesTablaRoles")->with(array("roles" => Role::all())); return Response::json(array("estado" => "2", "html" => $html)); } }
public function asignarRol() { $datos = (string) Input::get("rol"); $array = explode(",", $datos); $num = count($array); for ($i = 0; $i < $num; $i++) { $roles = explode(".", $array[$i]); $id = (int) $roles[1]; $rol = (int) $roles[0]; //$permisos = Permisos::all(); //$permisos = Permisos::find($id); Permisos::where("user_id", "=", $id)->update(array("role_id" => $rol)); //$permisos->role_id = $rol; //$permisos->save(); } return Response::json(array("estado" => 1)); }