Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 1941dd7

Browse files
committed
Limit the category name
1 parent 17fa270 commit 1941dd7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

database/factories/CategoryFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CategoryFactory extends Factory
2222
public function definition()
2323
{
2424
return [
25-
'name' => $this->faker->unique()->words(3, true),
25+
'name' => $this->faker->unique()->word,
2626
];
2727
}
2828
}

database/seeders/PostsTableSeeder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function run()
2323
$categories = Category::all();
2424

2525
Post::query()->each(function (Post $post) use ($categories) {
26-
$post->categories()->attach($categories->shuffle()->pluck('id')->take(rand(2, 5)));
26+
$post->categories()->attach($categories->shuffle()->pluck('id')->take(rand(1, 2)));
2727
});
2828
}
2929
}

0 commit comments

Comments
 (0)