This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
hi, i'm trying to get related images from another model in my php controller.
So i have this controller that gets every item from one model. The problem is that i dont know how to get the related images from another model into my php file. In another .htm file i saw that the images are getting loaded like this {{ record.imagePromo.thumb(750,450, {'mode':'crop'}) }}
But i dont know how to tell php "get related images"
In another Controller i have a view that gets rendered and can give the view the related model like this
$test = Rentable::find($rentable[0]->id);
$this->page['id'] = $rentable[0]->id;
$this->page['record'] = Rentable::find($test->id);
Anyone got an idea or need more context?
Thank you anyway
Last updated
Based on your supplied code, in PHP, this could look like
$images = $test->imagePromo()->get();
or even
$images = $test->imagePromo;
Last updated
1-3 of 3