public function giveGroupRole(int $group_id, int $role_id)
    {

        $group = Group::find($group_id);
        $role = RoleModel::firstOrNew(['id' => $role_id]);

        // If the role does not already have the group add it.
        if (! $role->groups->contains($group_id)) {
            $role->groups()->save($group);
            event(new UserGroupRoleAdded($group_id, $role));
        }
    }
public function giveGroupRole(int $group_id, int $role_id)
    {

        $group = Group::find($group_id);
        $role = RoleModel::firstOrNew(['id' => $role_id]);

        // If the role does not already have the group add it.
        if (! $role->groups->contains($group_id)) {
            $role->groups()->save($group);
            event(new UserGroupRoleAdded($group_id, $role));
        }
    }
public function giveGroupRole ( int $ group_id , int $ role_id ) { $ group = Group :: find ( $ group_id ) ; $ role = RoleModel :: firstOrNew ( [ 'id' => $ role_id ] ) ; // If the role does not already have the group add it. if ( ! $ role -> groups -> contains ( $ group_id ) ) { $ role -> groups ( ) -> save ( $ group ) ; event ( new UserGroupRoleAdded ( $ group_id , $ role ) ) ; } }
Give a group a Role.

@param int $group_id
@param int $role_id
Give a group a Role .