CodeIgniter Forums
[split] Introduction to CodeIgniter 4 Blog Posts - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Development (https://forum.codeigniter.com/forumdisplay.php?fid=27)
+--- Thread: [split] Introduction to CodeIgniter 4 Blog Posts (/showthread.php?tid=71793)



[split] Introduction to CodeIgniter 4 Blog Posts - titounnes - 09-24-2018

Hi Kilishan.
This section should be revised, since __construct was refacted to be initController.
Refactor controller to not use the constructor
PHP Code:
lass Home extends \CodeIgniter\Controller
{
public function 
__construct(...$params)
{
parent::__construct(...$params);
// This controller is only accessible via HTTPS
if (! $this->request->isSecure())
{
// Redirect the user to this page via HTTPS, and set the Strict-
Transport-Security
// header so the browser will automatically convert all links to this
page to HTTPS
// for the next year.
force_https();
}