Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a private method on library codeigniter

I have a library called privacy, I made a function private called _user_block_by_team and i want call this function on another public function on the same library like the following code, but it give to me an error Fatal error: Call to undefined method Team::_user_block_by_team() where i'm doing mistake? This library is on autoload from the file autoload.php

class Privacy {

    function __construct()
    {
        $this->ci =& get_instance();    
    }

    function user_block_team($id_user) {
        $this->ci->_user_block_by_team($id_user);
    }

    function _user_block_by_team($id_user) {
        $this->ci->load->library('settings');
        if ($this->ci->settings->check_user_blocked($id_user)) {
            return false;
        }

        return true;
    }
}
like image 295
fabrizio Avatar asked Feb 01 '26 00:02

fabrizio


1 Answers

You can just call $this->_user_block_by_team($id_user).

like image 188
rid Avatar answered Feb 02 '26 12:02

rid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!