1<?php
2
3namespace Database\Seeders;
4
5use Illuminate\Database\Seeder;
6use Illuminate\Support\Facades\DB;
7use Illuminate\Support\Facades\Hash;
8use Illuminate\Support\Str;
9
10class DatabaseSeeder extends Seeder
11{
12 /**
13 * Run the database seeders.
14 *
15 * @return void
16 */
17 public function run()
18 {
19 DB::table('users')->insert([
20 'name' => Str::random(10),
21 'email' => Str::random(10).'@gmail.com',
22 'password' => Hash::make('password'),
23 ]);
24 }
25}
1/**
2 * Run the database seeders.
3 *
4 * @return void
5 */
6public function run()
7{
8 $this->call([
9 UserSeeder::class,
10 PostSeeder::class,
11 CommentSeeder::class,
12 ]);
13}
1use App\Models\User;
2
3/**
4 * Run the database seeders.
5 *
6 * @return void
7 */
8public function run()
9{
10 User::factory()
11 ->times(50)
12 ->hasPosts(1)
13 ->create();
14}