You can extend one controller like this and then use this controller in other. It's good practice to save this controller in libraries, not in controllers.
This is base controller Base_CI.php in application/libraries
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Base_CI extends CI_Controller{
public function sendsecurityinvoice($data){
if(!empty($data)){
return $data;
}
}
}
Then in other controller Invoiceajax.php do this:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH.'/libraries/Invoiceajax.php';
class Invoiceajax extends Base_CI{
public function test() {
return $this->sendsecurityinvoice('Hi');
}
var_dump($this->test());
}