Example #1
0
 public function loadModels($ns, $dir)
 {
     if (file_exists($dir . '/' . $ns)) {
         return $this->app->import($ns, $dir);
     }
     $tables = $this->db->listTables();
     foreach ($tables as $table) {
         $model = '';
         if (ends_with($table, 'meta')) {
             $model = substr(ucfirst($table), 0, -4) . 'Meta';
         }
         Query::generateModel($this->db, $table, $model, $ns, true);
     }
     return $this->app->import($ns, $dir);
 }