src/ViKon/Auth/Model/User.php
public function hasPermission($permission)
    {
        if (!$this->permissions->where('token', $permission)->isEmpty()) {
            return true;
        }

        foreach ($this->groups as $group) {
            foreach ($group->roles as $role) {
                if (!$role->permissions->where('token', $permission)->isEmpty()) {
                    return true;
                }
            }
        }

        foreach ($this->roles as $role) {
            if (!$role->permissions->where('token', $permission)->isEmpty()) {
                return true;
            }
        }

        return false;
    }
public function hasPermission($permission)
    {
        if (!$this->permissions->where('token', $permission)->isEmpty()) {
            return true;
        }

        foreach ($this->groups as $group) {
            foreach ($group->roles as $role) {
                if (!$role->permissions->where('token', $permission)->isEmpty()) {
                    return true;
                }
            }
        }

        foreach ($this->roles as $role) {
            if (!$role->permissions->where('token', $permission)->isEmpty()) {
                return true;
            }
        }

        return false;
    }
public function hasPermission ( $ permission ) { if ( ! $ this -> permissions -> where ( 'token' , $ permission ) -> isEmpty ( ) ) { return true ; } foreach ( $ this -> groups as $ group ) { foreach ( $ group -> roles as $ role ) { if ( ! $ role -> permissions -> where ( 'token' , $ permission ) -> isEmpty ( ) ) { return true ; } } } foreach ( $ this -> roles as $ role ) { if ( ! $ role -> permissions -> where ( 'token' , $ permission ) -> isEmpty ( ) ) { return true ; } } return false ; }
Check if user has given permission

@param string $permission

@return bool
Check if user has given permission