*/ class AlbumFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => fake()->sentence(2), 'category_id' => Category::all()->random(1)->first()->id, ]; } }