Search code examples
phpcodeignitermethod-parameters

Can I pass arguments into a model function?


Is it even possible to do something like this in codeigniter?Is it considered a good practice in general?


Solution

  • Yes it is possible.

    I do it all of the time, if the data is not from post I can send it to the model.

    $this->load->model('some_model');
    $this->some_model->some_function($var);
    

    What data do you want to send to the model? This will help in deciding whether it is bad practice.