CodeIgniter Forums

Full Version: controllers and model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm a beginner with codeigniter, I'm trying to insert the records into the database, but the in the editor phpstorm I'm using showing the model as an unidentified. someone please help me with this.

Code:
public function index()
   {
       $this->load->library('form_validation');
       $data['title']= 'Workload';
       $this->load->model('Workload_Model');
       $data['workload']  = $this->Workload_Model->get_workload();
       $this->load->view('templates/header');
       $this->load->view('administrator/Workload', $data);
       $this->load->view('templates/footer');
   }
$data['workload']  = $this->Workload_Model->get_workload();
 workload_model in this line is showing not found.
@nikhil9989,

What is the model file name? Workload_Model or Worklord_model? Also, when you declared the class what name did you use? Workload_Model or Worklord_model? It may be the way you named your model class.
Might be a file and class naming problem. I suspect it is the uppercase M in Model. The file name should be Workload_model.php  (with that exact character case usage) and the class code should be as follows

PHP Code:
class Workload_model extends CI_Model 

Change the controller to look like this

PHP Code:
$this->load->model('workload_model');
$data['workload' $this->workload_model->get_workload(); 
not an error it should work just fine phpStorm doe's not see all of the CodeIgniter
classes in the frame work, there are work around's in the forums.