Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

BaseController.php 1.4KB

2 anos atrás
2 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Controllers;
  3. use CodeIgniter\Controller;
  4. use CodeIgniter\HTTP\CLIRequest;
  5. use CodeIgniter\HTTP\IncomingRequest;
  6. use CodeIgniter\HTTP\RequestInterface;
  7. use CodeIgniter\HTTP\ResponseInterface;
  8. use Psr\Log\LoggerInterface;
  9. /**
  10. * Class BaseController
  11. *
  12. * BaseController provides a convenient place for loading components
  13. * and performing functions that are needed by all your controllers.
  14. * Extend this class in any new controllers:
  15. * class Home extends BaseController
  16. *
  17. * For security be sure to declare any new methods as protected or private.
  18. */
  19. abstract class BaseController extends Controller
  20. {
  21. /**
  22. * Instance of the main Request object.
  23. *
  24. * @var CLIRequest|IncomingRequest
  25. */
  26. protected $request;
  27. /**
  28. * An array of helpers to be loaded automatically upon
  29. * class instantiation. These helpers will be available
  30. * to all other controllers that extend BaseController.
  31. *
  32. * @var array
  33. */
  34. protected $helpers = ['auth', 'session'];
  35. /**
  36. * Constructor.
  37. */
  38. public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
  39. {
  40. // Do Not Edit This Line
  41. parent::initController($request, $response, $logger);
  42. // Preload any models, libraries, etc, here.
  43. // E.g.: $this->session = \Config\Services::session();
  44. }
  45. }