在控制器中调用多个模型

Hello I am having trouble running more than one model in my controller.

The first model is encryption then the second model is insertion.

public function addStore()
{
    $name = $_POST['name'];
    $address = $_POST['address'];
    $gpsAddress = $_POST['gps_address'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    $status = 1;

    $this->load->model('EncryptionModel');
    $password = $this->EncryptionModel->encryptPassword($password);

    $this->load->model('StoresModel');
    $this->StoresModel->addStore($name, $address, $gpsAddress, $phone, $email, $password, $status);
}

The following is the error

Fatal error: Call to a member function addStore() on a non-object in \application\controllers\stores.php

This does not occur when the encryption model call is taken out.

Encryption Model as requested

class EncryptionModel extends CI_Controller {

public function encryptPassword($password)
{
    $options = ['cost' => 12];
    $password = password_hash($password, PASSWORD_BCRYPT, $options)."
";
    return $password;
}
}

Should be...

class EncryptionModel extends CI_Model {

Note CI_Model in place of where you had CI_Controller.


Also see the CodeIgniter class naming recommendations regarding upper and lower case best practices...

"Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names."

 

INCORRECT:
class superclass
class SuperClass

CORRECT:
class Super_class

class Super_class {
    function __construct()
    {

    }
}

Encryption Model was extending CI_Controller where it should be extending CI_Model

Thanks everyone.