The Repository Pattern is a common refactor that you may encounter in large Laravel applications. While it is not ideal for small to medium projects, it's a perfect solution for those applications that need an abstraction of the data layer.
Post Repository (Refactoring to a Repository)
To complete the ProcessCommand class, we are going to extract the logic to save a post to it's own class using the repository pattern. We will complete the lesson by giving the user better feedback on what the command has done.