1

I am new on Codeigniter and i have a question. In controller classes i need to use session, request and validation objects in every method So for each method i have to create an instance of them like below:

$session=\Config\Services::session();
$validation=\Config\Services::validation();
$request=\Config\Services::request();

How can i make one instance for whole the controller methods? I tried to creat property but it seems that i can not use an object as a property I would be thankful if you help me with that

Ramin
  • 13
  • 4

1 Answers1

1

Make them globals - some suggestions of different approaches for how to achieve this in this thread

steve
  • 2,469
  • 1
  • 23
  • 30