CI accessing property on interface CI accessing property on interface laravel laravel

CI accessing property on interface


To fix the problem for the id of the authenticated user, you should use:

$this->auth->user()->getAuthIdentifier()

Interface consists of methods. You are accessing attribute directly. eg $foo->id instead of $foo->getId(). And you have to add new method to interface of course.

The workaround is to say to scrutinizer, that $object is instance of desired class.

if ($object instanceof MyClass) {    //}