I have a table of housing developments that has a simple structure -
development_id, name, address, etc
Each development has a number of plots for sale with a structure like -
plot_id, development_id, price
They are related in the DevelopmentsTable.php file -
$this->hasMany('Plots', [ 'foreignKey' => 'development_id', ]);
For each development I need to show what the maximum and minimum prices for the plots the development contains are. I’m not at all sure how to go about doing this except by cycling through all the plots in the view and finding the maximum and minimum which doesn’t seem like a good way of doing it.
Any suggestions on a better way would be useful.