<commit_before><?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\Model\User;
use App\Model\Role;
use Faker\Factory as Faker;

class UserRoleTableSeeder extends Seeder
{
    public function run()
    {
        Model::unguard();
        $faker = Faker::create();

        $userIds = User::lists('id')->all();
        $roleIds = Role::lists('id')->all();

        foreach (range(1, 400) as $index) {
            $pair = $faker->unique()->randomElement([
                [$faker->randomElement($roleIds), $faker->randomElement($userIds)],
                [$faker->randomElement($roleIds), $faker->randomElement($userIds)]
            ]);

            DB::table('role_user')->insert([
                'role_id' => $pair[0],
                'user_id' => $pair[1]
            ]);
        }
    }
}<commit_msg>added route to get all users belonging to a role<commit_after><?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\Model\User;
use App\Model\Role;
use Faker\Factory as Faker;

class UserRoleTableSeeder extends Seeder
{
    public function run()
    {
        Model::unguard();
        $faker = Faker::create();

        $userIds = User::lists('id')->all();
        $roleIds = Role::lists('id')->all();

        foreach (range(1, 200) as $index) {
            $pair = $faker->unique()->randomElement([
                [$faker->randomElement($roleIds), $faker->randomElement($userIds)],
                [$faker->randomElement($roleIds), $faker->randomElement($userIds)]
            ]);

            DB::table('role_user')->insert([
                'role_id' => $pair[0],
                'user_id' => $pair[1]
            ]);
        }
    }
}
{'fraction_non_alphanumeric': 0.1692936368943374, 'fraction_numerical': 0.0070052539404553416, 'mean_word_length': 2.3346303501945527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3384128', 'n_tokens_mistral': 540, 'n_tokens_neox': 522, 'n_words': 95}