I have probably made a very simple mistake with this, but I do not see how.. If any of you could help me, I would appreciate it lots.
This is my error:
Notice: Undefined index: admin in C:\xampp\htdocs\forums\classes\User.php on line 75 
Here is User.php
public function hasPermission($key) {
    $group = $this->_db->get('groups', array('id', '=', $this->data()->group));
    if ($group->count()) {
        $permissions = json_decode($group->first()->permissions, true);
        if ($permissions[$key] == true) { <<< This is line 75 <<<
            return true;
        }
    }
    return false;
}
Here is where I use hasPermission()
if($user->hasPermission("admin")){
    echo "You are an administrator";
}
var_dump($key);:
string(5) "admin"
var_dump($permissions);
array(1) { ["admin"]=> int(1) }
var_dump($permissions[$key]); outputs:
NULL
 
     
    