I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4.
Several entities are present in all controllers (except Login.php and Register.php): static data, categories and pages.
$data = $this->Static_model->get_static_data();
$data['pages'] = $this->Pages_model->get_pages();
$data['categories'] = $this->Categories_model->get_categories();
Further more, in most controller, the code above appears more then one time.
I am afraid this is mot the only case of repetitive code in the application. (See the entire application, at its current state, on my Github account).
I am looking for specific and/or general advice from experienced PHP developers that would help me reduce code redundancy and make it more efficient.
What is the best way to avoid the repeating of the code above in my controllers?