pgrzesiecki / laravel-acl

Advanced ACL for Laravel
50 stars 22 forks source link

DuplicateEntryException in EloquentAclRepository.php line 301: #13

Closed andisulistyonugroho closed 7 years ago

andisulistyonugroho commented 7 years ago

Hi @szarik88 I'm using the code from your master branch. When I set the $action is true on grantUserPermission I got and Exception about parameter mismatch, this is my code and the exception, it seems the required $action format is a serialized array?

\Acl::grantUserPermission($permission_found, $user, true, true);
DuplicateEntryException in EloquentAclRepository.php line 301:
preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
andisulistyonugroho commented 7 years ago

I did make the exception gone by changing this line on EloquentAclRepository.php:298

From

$actions = ($actions === true) ? $permission->getActions() : serialize($actions);

to

$actions = ($actions === true) ? serialize($permission->getActions()) : serialize($actions);