in my codeigniter 4 project i got an error massage: Call to a member function getVar() on null.
It just happens in the construct:
namespace App\Controllers;
use CodeIgniter\RESTful\ResourceController;
use App\Controllers\BaseController;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\Response;
public function __construct() {
$this->request->getVar('key'); //Not works
}
public function index() {
$this->request->getVar('key'); //Works
}
Any suggestions? Thanks.