0
我有一個動態複選框,並希望使用PUT方法更新Laravel Sentry上的用戶組。 不知何故,這與沒有工作代碼相同。更新Laravel Sentry用戶組
$array_of_group_id = [1,2,3];
$user = Sentry::findUserById(1);
// Find the group using the group id
$updateGroup = Sentry::findGroupById($array_of_group_id);
// Assign the group to the user
if ($user->updateGroup($updateGroup))
{
// Group assigned successfully
}
else
{
// Group was not assigned
}
太棒了!儘管'removeAllGroups'函數很好,這是一個不錯的選擇 – developerbmw 2015-08-12 23:57:40