How does it proxies getXxxAttribute methods?
mityukov opened this issue · comments
Vladimir Mityukov commented
I have lots of getXxxAttribute methods on some of my models, because I find this feature very convenient (with its automatic caching). Will those methods or properties (they make) be available in view model?
Brent Roose commented
View models have no correlation to Laravel models. You can read about how data is exposed via a view model here: https://github.com/spatie/laravel-view-models#usage
My suggestion would be one of two things:
- Expose your model itself via the view model, not its properties.
- Use data transfer objects if you're working with complex data.