Skip to content

Commit 886491c

Browse files
committed
Update database seeders & factories
1 parent ef73b49 commit 886491c

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

database/factories/UserFactory.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Database\Factories;
44

55
use App\Models\User;
6-
use Carbon\Carbon;
76
use Illuminate\Database\Eloquent\Factories\Factory;
87
use Illuminate\Support\Facades\Hash;
98
use Illuminate\Support\Str;
@@ -17,11 +16,11 @@ class UserFactory extends Factory
1716

1817
public function definition(): array
1918
{
20-
$email = fake()->email();
19+
$email = fake()->unique()->email();
2120

2221
return [
2322
'name' => fake()->name(),
24-
'username' => 'u' . Carbon::now()->setMillisecond(0)->timestamp,
23+
'username' => fake()->unique()->word(),
2524
'avatar' => 'https://www.gravatar.com/avatar/' . hash('sha256', strtolower(trim($email))),
2625
'email' => $email,
2726
'email_verified_at' => now(),

database/seeders/DatabaseSeeder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ class DatabaseSeeder extends Seeder
1313
*/
1414
public function run(): void
1515
{
16-
// User::factory(10)->create();
16+
User::factory(100)->create();
1717

18-
User::factory()->create([
19-
'name' => 'Test User',
20-
'email' => 'test@example.com',
21-
]);
18+
// User::factory()->create([
19+
// 'name' => 'Test User',
20+
// 'email' => 'test@example.com',
21+
// ]);
2222
}
2323
}

0 commit comments

Comments
 (0)