Laravel refactoring exercise