What does the error mean and how do I fix it?
( Notice: Trying to access array offset on value of type null in....)
public function hasPermission($key)
{
$group = $this->_db->get('groups', array('id', '=', $this->data()->group));
if ($group->count()) {
$permissions = json_decode($group->firstResult()->permissions, true);
if ($permissions[$key] == true) {
return true;
}
}
return false;
}
The error is on this line:
if ($permissions[$key] == true) {
Regards