0

Unable to locate the model you have specified: Empresa_model

Filename: /opt/lampp/htdocs/actzap_CI/system/core/Loader.php

I've wrote this code many times and the problem persists, can someone help? sorry for my bad english

Model:

    class Empresa_model extends CI_Model {
        //...
        function __construct(){
              parent::__construct();
        }

        public function listaEmpresas(){

            return $this->db->get("empresa")->result_array();
        }
        //...
    }

Controller:

class Empresa_controller extends CI_Controller

    public function index()
    {
        $this->load->model('empresa_model');

        $lista = $this->empresa_model->listaEmpresas();

        $dados = array("empresa" => $lista);

        $this->template->show('empresa', $dados);
    }
    //...
}

FULL ERROR :

An uncaught Exception was encountered
Type: RuntimeException

Message: Unable to locate the model you have specified: Empresa_model

Filename: /opt/lampp/htdocs/actzap_CI/system/core/Loader.php

Line Number: 348

Backtrace:

File: /opt/lampp/htdocs/actzap_CI/application/controllers/Empresa_controller.php
Line: 9
Function: model

File: /opt/lampp/htdocs/actzap_CI/index.php
Line: 315
Function: require_once
Christopher Richa
  • 1,278
  • 1
  • 9
  • 20
  • did you make sure that the model's filename is `Empresa_model.php` (note the upper-case E) and is located in `application/models/Empresa_model.php`? CI is a bit finicky when it comes to filenames that don't adhere to its internal naming convention and/or are not where the CI core expects them to be – Javier Larroulet Aug 26 '19 at 19:41
  • controler : Empresa_controller.php model : empresa_model.php yes, i've checked a 1000 times :( – Johann Kaltner DOliveira Aug 26 '19 at 20:30
  • this error is caused, when your model is NOT starting with uppercase! change it to Empresa_model.php – Vickel Aug 26 '19 at 20:40
  • and possible duplicate of: https://stackoverflow.com/a/28506674/2275490 – Vickel Aug 26 '19 at 20:44

0 Answers0