Sentry多组分配

时间:2014-09-05 12:04:23

标签: php laravel cartalyst-sentry

我想使用哨兵为用户分配多个组,我该如何实现?

我有一个包含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]);

1 个答案:

答案 0 :(得分:0)

找到解决方案

foreach ($group as $g) { $addGroup= Sentry::findGroupById($g); $user->addGroup($addGroup); }