Skip to content

Commit

Permalink
Fix for user seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko259 committed Aug 2, 2024
1 parent 4bc26cf commit dce2b92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function run(): void
]);

// Assign groups randomly, or specific group for user 10
if ($i !== 11) {
if ($i == 10) {
$user->groups()->attach(Group::find($group), ['area_id' => 1]);
} else if ($i !== 11) {
$randomGroup = $groups->random(rand(0, $groups->count()))->pluck('id')->toArray();
$user->groups()->attach($randomGroup);
}
Expand Down

0 comments on commit dce2b92

Please sign in to comment.