Skip to content

Commit 3d1cf99

Browse files
committed
improve Users inGroup() method to accept group ID (before object and string only)
1 parent 7ea8c42 commit 3d1cf99

File tree

1 file changed

+12
-0
lines changed
  • src/Darryldecode/Backend/Components/User/Models

1 file changed

+12
-0
lines changed

src/Darryldecode/Backend/Components/User/Models/User.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ public function inGroup($group)
173173

174174
return $found;
175175
}
176+
else if ( is_int($group) )
177+
{
178+
$this->groups->each(function($g) use ($group, &$found)
179+
{
180+
if( $g->id == $group )
181+
{
182+
$found = true;
183+
}
184+
});
185+
186+
return $found;
187+
}
176188
else if ( is_object($group) )
177189
{
178190
$this->groups->each(function($g) use ($group, &$found)

0 commit comments

Comments
 (0)