Brent explains what view models are and how you can use them. We use view models in almost every project at Spatie.
In essence, view models are simple classes that take some data, and transform it into something usable for the view. In this chapter I’ll show you the basic principles of the pattern, we’ll take a look at how they integrate in Laravel projects, and finally I’ll show you how we use the pattern in one of our projects.
Source: Freek Van der Herten