我想使用哨兵为用户分配多个组,我该如何实现?
我有一个包含id,name和permissions列的组表。
$groups = Sentry::findGroupById(1); anyway I can get multiple groups and then assign
$groups while creating user $user = Sentry::register([ 'permisions' => $groups]);
答案 0 :(得分:0)
找到解决方案
foreach ($group as $g) {
$addGroup= Sentry::findGroupById($g);
$user->addGroup($addGroup);
}