I am trying to set permissions to users and when i put this in my database config code
public function hasPermission($key) {
$group = $this->_db->get('groups', array('id', '=', $this->data()->group));
print_r($group->first());
}
with the combination of this code that is in in my my home page
if($user->hasPermission('admin')) {
echo '<p>You are an administrator!</p>';
}
The problem I get occurs and says:
Undefined offset: 0 in C:\xampp\htdocs\Sites\ooplr\classes\DB.php on line 120
I then go and the code it has a problem with is
public function first() {
return $this->results()[0];
}
Please Help!