CakePHP : Load Model from other Controller


In your Controller were you want to load the model.

<?php
 
  App::import('Controller');

  class ReportsController extends AppController { 
 
     
    public function other_reports() {

          //this will load other model 
          $this->loadModel('OtherModel');
          $otherModels = $this->OtherModel->find('all');
          $this->set('otherModels', $otherModels);

    } 
 
 
  }
?>
Post a Comment

Popular posts from this blog

CakeAdminLTE is based on AdminLTE Theme for CakePHP 2.4+

CakePHP: COUNT data and GROUP BY date

CakePHP: Calling function from other controller