Hi so I have an issue.
I create an AuthComponent session in my users controller. This works fine. I can access all the Auth methods such as $this->Auth->user(‘id’) in all my other controllers.
However the issue is that when I try to use the same function $this->Auth->user(‘id’) in the components that are used by these controllers i get the following error:- Fatal error: Call to a member function user() on a non-object
At the top of the compnents I have the following code:-
namespace app\Controller\Component;
use App\Controller\AppController;
use Cake\Controller\Component;
use Cake\Controller\Component\AuthComponent;
I must be missing something. Can someone please help me out