Skip to content

Commit

Permalink
use sync to seed relations
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-xz committed Jul 25, 2024
1 parent f5001a6 commit 5c57705
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions database/seeders/TaskLabelSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class TaskLabelSeeder extends Seeder
public function run(): void
{
for ($i = 0; $i < 5; $i++) {
Task::all()->random()->labels()->saveMany([
Label::all()->random(),
Label::all()->random()
Task::all()->random()->labels()->sync([
rand(1, 4),
rand(1, 4)
]);
}
}
Expand Down

0 comments on commit 5c57705

Please sign in to comment.