public function giveGroupsRole(array $group_ids, int $role_id)
    {

        foreach ($group_ids as $group_id) {

            $group = Group::where('id', $group_id)->first();
            $this->giveGroupRole($group->id, $role_id);
        }
    }
public function giveGroupsRole(array $group_ids, int $role_id)
    {

        foreach ($group_ids as $group_id) {

            $group = Group::where('id', $group_id)->first();
            $this->giveGroupRole($group->id, $role_id);
        }
    }
public function giveGroupsRole ( array $ group_ids , int $ role_id ) { foreach ( $ group_ids as $ group_id ) { $ group = Group :: where ( 'id' , $ group_id ) -> first ( ) ; $ this -> giveGroupRole ( $ group -> id , $ role_id ) ; } }
Give an array of group_ids a role.

@param array $group_ids
@param int   $role_id
Give an array of group_ids a role .