BaseController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Controllers;
  3. use CodeIgniter\Controller;
  4. use CodeIgniter\HTTP\RequestInterface;
  5. use CodeIgniter\HTTP\ResponseInterface;
  6. use Psr\Log\LoggerInterface;
  7. /**
  8. * BaseController provides a convenient place for loading components
  9. * and performing functions that are needed by all your controllers.
  10. *
  11. * Extend this class in any new controllers:
  12. * ```
  13. * class Home extends BaseController
  14. * ```
  15. *
  16. * For security, be sure to declare any new methods as protected or private.
  17. */
  18. abstract class BaseController extends Controller
  19. {
  20. /**
  21. * Be sure to declare properties for any property fetch you initialized.
  22. * The creation of dynamic property is deprecated in PHP 8.2.
  23. */
  24. // protected $session;
  25. /**
  26. * @return void
  27. */
  28. public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
  29. {
  30. // Load here all helpers you want to be available in your controllers that extend BaseController.
  31. // Caution: Do not put the this below the parent::initController() call below.
  32. // $this->helpers = ['form', 'url'];
  33. // Caution: Do not edit this line.
  34. parent::initController($request, $response, $logger);
  35. // Preload any models, libraries, etc, here.
  36. // $this->session = service('session');
  37. }
  38. }