Welcome Guest, Not a member yet? Register   Sign In
Access to model functions throught custom library
#4

(This post was last modified: 01-20-2018, 09:29 AM by dave friend.)

(01-19-2018, 11:22 AM)LEBOSSS Wrote: Hi everybody!
I am not strong in English so please excuse me in advance if it is not very clear.
I'm creating my own library for authentication of my users but the problem is that apparently, it is impossible to access the to models functions from the library.
So it's impossible for me to do something like
PHP Code:
$this->CI->zauth_model->get_by('email'$email

Is it me who does it badly or there is  another way to do it?
Thank you

That will work if CI has the right value. This is the usual way to do that.
PHP Code:
class Example
{
     protected 
$CI;

     public function 
__construct()
    {
          
$this->CI = & get_instance();
          $this->CI->load->model('zauth_model');
    }

    public function use_model()
    {
          $this->CI->zauth_model->get_by('email'$email);
    }

Reply


Messages In This Thread
RE: Access to model functions throught custom library - by dave friend - 01-20-2018, 09:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB