title: Trait in CodeIgniter
body: <p>I'm trying to use traits in CodeIgniter. I put the Trait in the libraries directory and then loaded the library in the controller. Then I used the trait in the model, but it didn't work and I received the following error</p>
  
  <p>Trait file (in library):
      
  
  <pre><code>trait DataTablesTrait{
      public function query(){
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;limit(10, 1);
          return $this-&gt;db-&gt;get('my_table');
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>class myController extends CI_Controller {  
  
      public function __construct(){
          parent::__construct();
          $this-&gt;load-&gt;library('DataTablesTrait');
          $this-&gt;load-&gt;model('ABC_Model');
      }
  } 
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>class ABC_Model extends CI_Model {
      use DataTablesTrait;
      function callQuery(){
          $this-&gt;query();
      }
  }
  </code></pre>
  
  <p>I got this error: </p>
  
  <blockquote>
    <p>Non-existent class: DataTablesTrait</p>
  </blockquote>
  
  <p>Please advise</p>