I created a gist to show you the RoleAuthorize.php with refactoring. it cleaner on this way :) https://gist.github.com/1809810