modifying BaseController.php for libraries |
I am trying to autoload libraries in BaseController.php. Is DoNotEditThisLine really just a comment?
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { // Do Not Edit This Line parent::initController($request, $response, $logger); <<this line is causing an error. Is this really just a comment? // Preload any models, libraries, etc, here. protected $libraries=[ 'grocery_CRUD', 'email', 'image_lib', 'image_CRUD', 'ftp', 'form_validation' ]; }
proof that an old dog can learn new tricks
CodeIgniter 4 User Guide - CodeIgniter4 Overview Autoloading Files
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
You cannot remove the line "parent::initController($request, $response, $logger);".
If you do it, Controllers won't work. You cannot use "protected" keyword in class methods in PHP. |
Welcome Guest, Not a member yet? Register Sign In |