BaseController.php 613 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Controllers;
  3. use App\Services\Auth;
  4. use App\Services\View;
  5. /**
  6. * BaseController
  7. */
  8. class BaseController
  9. {
  10. public $view;
  11. public $smarty;
  12. public function construct__()
  13. {
  14. }
  15. public function smarty()
  16. {
  17. $this->smarty = View::getSmarty();
  18. return $this->smarty;
  19. }
  20. public function view()
  21. {
  22. return $this->smarty();
  23. }
  24. /**
  25. * @param $response
  26. * @param $res
  27. * @return mixed
  28. */
  29. public function echoJson($response, $res)
  30. {
  31. return $response->getBody()->write(json_encode($res));
  32. }
  33. }