Skip to content

Undefined index: id during attachPermission using array #352

Open
@alextime

Description

@alextime

Using attachPermission with object works fine, but using array returns the error "undefined index id".

Role::find(1)->attachPermission([$p1, $p2]);
or
Role::find(1)->sync([$p1->id, $p2->id]);
same result. The error should be on EntrustRoleTrait.php line 87, where you check

if (is_array($permission)) {
$permission = $permission['id'];
}

but in that case $permission is an array with no id property in it, isn't?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions