*/ protected $helpers = []; /** @var ApiClient */ protected ApiClient $api; /** * Be sure to declare properties for any property fetch you initialized. * The creation of dynamic property is deprecated in PHP 8.2. */ // protected $session; /** * @return void */ public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { // Do Not Edit This Line parent::initController($request, $response, $logger); // Preload any models, libraries, etc, here. // E.g.: $this->session = \Config\Services::session(); session(); // Shared API client available to all controllers $this->api = service('apiClient'); } /** * Get the user role from the session or database * * @return string|null */ protected function getUserRole() { // Assuming the user role is stored in the session return session()->get('role'); } } ?>