Im searching for best way/solution to use controller's functions in multiple controllers - multiple applications in one administration interface.
In other words: One subpage (users) i need use in 3 subpages:
controllers:
all controllers have own functions and interface.
admin -> controllers -> eshop-settings.php contains subpages/functions:
admin -> controllers -> web-settings.php contains subpages/functions:
...etc.
All controllers have subpage "users" but not all functions (fe. tab. all-users) and "user_edit",
Is possible join controllers or add part controller to another in Codeigniter?
Or I need create "user" functions and call them to each other controller and hes interface.
Thanks
Controllers should only call services and pass data to those services, receive data back, and send to view. Maybe catch Exceptions also.
Take your business logic out of your controllers, and create a service class for the shared functionality.
Then you could do things like this:
$svc = new UserService($dbConnection);
$user = $svc->getUserByEmail('coder@work.com');