Welcome Guest, Not a member yet? Register   Sign In
Access to libraries in MY_Model
#5

(This post was last modified: 09-29-2015, 04:57 AM by scion.)

(09-28-2015, 11:01 AM)InsiteFX Wrote: Try just loading the library in your controller then call your library methods in your model.

Thats why I write here - I try to load library in MY_COntroller (or Public_Controller or whatever Controller) and in MY_Model i get error describe above.

I dont understand why this is working so, but i found the solution. In base MY_Controller I get super object like next:


PHP Code:
$ci =& get_instance();
 
      
$ci
->login false;
 
      
$ci
->_user null;
 
      
 
if($this->ion_auth->logged_in() && !$this->ion_auth->is_admin())
 {
 
          $ci->login true;
 
          $ci->_user $this->ion_auth->user()->row();
 
 

After that I can assecc to login and user in any Controller or MY_Model or Model with simple $this->login and $this->_user

Thanks for participation in the discussion

 
Reply


Messages In This Thread
Access to libraries in MY_Model - by scion - 09-27-2015, 01:36 PM
RE: Access to libraries in MY_Model - by InsiteFX - 09-27-2015, 04:20 PM
RE: Access to libraries in MY_Model - by scion - 09-28-2015, 02:49 AM
RE: Access to libraries in MY_Model - by InsiteFX - 09-28-2015, 11:01 AM
RE: Access to libraries in MY_Model - by scion - 09-29-2015, 04:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB