0

Anyone have idea why on this code:

Controller:

class GeneratedInvoices extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library("Inv_bg");
        $this->load->helper('url');
    }

    public function index(){

        $data['invoices'] = $this->Inv_bg->getInvoices();
        $this->load->view('GeneratedInvoices', $data);
    }
}

And library

public function getLists($type)
    {
        $response = \Httpful\Request::get($this->baseURL. $type)
                    ->authenticateWith($this->username, $this->password)
                    ->sendsJson()
                    ->expectsType("json")
                    ->send();

        return json_decode($response, true);
    }
    public function getInvoices()
    {
        $invoices = $this->getLists("invoices");
        return $invoices['invoices'];
    }

Gives me an error such as:

Message: Undefined property: GeneratedInvoices::$Inv_bg

I know that is issue because I worked first on Windows and uploaded this code on a Linux server, but I can't find the error :)

Zaedian
  • 251
  • 5
  • 24
  • is your Inv_bg file is also in capital letter? – Riyenz Mar 06 '18 at 09:17
  • And on windows you worked with error_repoting turned off and did not see the warning. – u_mulder Mar 06 '18 at 09:18
  • Please confirm that case is same(Upper case-lower case). Because in linux it is case-sensitive – B. Desai Mar 06 '18 at 09:18
  • 1
    i don't know why this was duplicated - because this is mostly CI related it doesn't help op to solve this problem because you've to know the background... - so @u_mulder you should probably reopen it... @Rade Illijev take a look here https://www.codeigniter.com/user_guide/general/creating_libraries.html#using-your-class - you've access to the variable only in lowercase form - so `$this->inv_bg->getInvoices();` should do the job – Atural Mar 06 '18 at 13:27

0 Answers0