If I have 2 views, for example, greenhouses and greenhouses and the query to the database is exactly the same, do I have to create the same function twice for each one? for example
public function casasamarillas() {
$casasamarillas = TableRegistry::get('Casas');
$this->set('casasamarillas', $casasamarillas->find('all'));
}
public function casasverdes() {
$casasverdes = TableRegistry::get('Casas');
$this->set('casasverdes', $casasverdes->find('all'));
}
or I can do something like:
public function casasamarillas() {
$casas = TableRegistry::get('Casas');
$this->set('casas', $casas->find('all'));
}
public function casasverdes($casas) {
$this->set('casas', $casas->find('all'));
}