Laravel code rewritten from scratch