title: Codeigniter: Call to undefined function (model)
body: <p>I get the following error: </p>
  
  <blockquote>
    <ul>
    <li>Fatal error: Call to undefined function getAll() in
    ...application\controllers\restserver.php on line 18</li>
    <li>A PHP Error was encountered</li>
    <li>Severity: Error</li>
    <li>Message: Call to undefined function get()</li>
    <li>Filename: controllers/restserver.php</li>
    <li>Line Number: 24</li>
    <li>Backtrace:</li>
    </ul>
  </blockquote>
  
  <p>And I have the following Controller: <strong>restserver.php</strong></p>
  
  <pre><code>defined('BASEPATH') OR exit('No direct script access allowed');
  require APPPATH . '/libraries/REST_Controller.php';
  
  class Restserver extends REST_Controller {
  
      public function __construct() {
          parent::__construct();
  
          $this-&gt;load-&gt;database();
          $this-&gt;load-&gt;helper('url');
      }
  
      public function appproviders_get() {
          $this-&gt;load-&gt;model('appproviders_model');
          $this-&gt;response($this-&gt;appproviders_model&gt;getAll());
     }
  
      public function appprovider_get() {
          $data = array('returned: '. $this-&gt;get('id'));
          $this-&gt;load-&gt;model('appproviders_model');
          $this-&gt;response($this-&gt;appproviders_model&gt;get($data));
     }
  }
  </code></pre>
  
  <p>And the following model: <strong>appproviders_model.php</strong></p>
  
  <pre><code>class appproviders_model extends CI_Model {
  
  function __construct(){
  
      parent::__construct();//Call the model constructor
  }
  
  function get($id = 0)
  {
      $this -&gt; db -&gt; select('appprovider.*');
      $this -&gt; db -&gt; from('appprovider');
      $this -&gt; db -&gt; join('appusers','appprovider.userID = appusers.id','left');
      $this -&gt; db -&gt; where('appprovider.id', $id);
  
      $query = $this -&gt; db -&gt; get();
  
      if($query-&gt;num_rows()&gt;0){
          $row = $query-&gt;row();
          return $row;
      } else {
          return NULL;
      }
  }
  
  function getAll()
  {
      $this -&gt; db -&gt; select('appprovider.*, appusers.name as name');
      $this -&gt; db -&gt; from('appprovider');
      $this -&gt; db -&gt; join('appusers','appprovider.userID = appusers.id','left');
      $this -&gt; db -&gt; where('appprovider.status', 1);
  
      $query = $this -&gt; db -&gt; get();
  
      if($query-&gt;num_rows()&gt;0){
          $row = $query-&gt;row();
          return $row;
      } else {
          return NULL;
      }
      }
  }
  </code></pre>
  
  <p>And I'm using the following RESTful server implementation for CodeIgniter:</p>
  
  <p><a href="https://github.com/chriskacerguis/codeigniter-restserver" rel="nofollow noreferrer">https://github.com/chriskacerguis/codeigniter-restserver</a></p>
  
  <p>Any idea why when I call from the browser:</p>
  
  <pre><code>.../restserver/appprovider?id=1;format=json
  </code></pre>
  
  <p>or</p>
  
  <pre><code>.../restserver/appproviders?format=json
  </code></pre>
  
  <p>I get the errors detailed at the beginning of the post? 
  It is indeed detecting the model but not its functions.</p>
  
  <p>Must be something so simple, but I cannot find the error and I'm going totally crazy ...</p>