Laravel Seeding

Create a seeder class

php artisan make:seeder UserSeeder  //here UserSeeder class

open your seeder class and add the model, where you want to create data.

add this line:
use App\Models\User;


add this function:

 User::factory()->create([
            'name' => 'Sujon',
            'email' => 'sujon@gmail.com'
        ]);



from the database seeder class, call this seeder

$this->call([
            UserSeeder::class
        ]);

Leave a Comment