I feel like, that's because I'm not accessing the model, so I can't use the method.
Since the above loads the Page and that there eager loads PageImages the PageImage is JSON, so I'm trying to use method by trying to select JSON.
So when I do $props->imageVariations[0]->getFirstMediaUrl('image')) - that makes no sense, its like if I'm trying to access a value called getFirstMediaUrl or either some method in JSON?
SO I feel like I need to create a new method in the model for PageImage? And use polymorphic relationship to get the 'thumbnail' or whatever, I think.
Not sure, something like this anyway I think.
I get this when I output imageVarations[0]
{"id":3,"site_page_id":514,"site_variation_id":3,"image":"https:\/\/i.imgur.com\/mjZn29x.png","created_at":"2022-06-06T12:27:35.000000Z","updated_at":"2022-06-06T12:27:35.000000Z","device":"desktop","theme":"light"}
Which is what I want, and then the other part is included, but in that case, I need to also get or pre-fetch the image on request or something I think - the image filed there needs to be removed, as I store images in media tables now.
So I guess that's the issue with eager loading the variations, is that then I can't tell the variation JSON, to load its image