<?php

$factory->define(App\Models\Group::class, function (Faker\Generator $faker) {
    return [
        'group_id' => function () use ($faker) {
            // try to avoid accidentally granting permissions based on hardcoded group ids
            return $faker->numberBetween(40, 100);
        },
        'group_name' => function () use ($faker) {
            return $faker->colorName().' '.$faker->domainWord();
        },
        'group_desc' => function () use ($faker) {
            return $faker->sentence();
        },
    ];
});

<?php

use App\Models\Group;

$factory->define(App\Models\Group::class, function (Faker\Generator $faker) {
    return [
        // try to avoid accidentally granting permissions based on hardcoded group ids
        'group_id' => max(Group::max('group_id'), 40) + 1,
        'group_name' => function () use ($faker) {
            return $faker->colorName().' '.$faker->domainWord();
        },
        'group_desc' => function () use ($faker) {
            return $faker->sentence();
        },
    ];
});

Fix group factory to prevent causing primary key conflicts
Fix group factory to prevent causing primary key conflicts
