Laravel Seeder Generator

Generate a complete Laravel database Seeder class with Faker-based column definitions and record count.

Singular CamelCase, e.g. Post, User, Product

Auto-filled from model name. Convention: {Model}Seeder.

Auto-filled from model name as snake_case + plural.

Define each column's name and Faker formatter type. Leave Faker type blank to skip.

DB::table() generates inline Faker data. factory() delegates to the model's factory class.

Insert records in batches to avoid memory issues with large datasets.

Generated Seeder 0 chars · 0 bytes

How to Use the Laravel Seeder Generator

This tool helps you quickly create a Laravel database seeder class with Faker-generated data. Follow these steps:

  1. Enter the model name — Type a singular CamelCase name like Post. The seeder class name and table name auto-fill.
  2. Set the record count — Choose how many fake records to generate (default: 50).
  3. Define columns — Add rows for each database column, select a Faker formatter type, and optionally provide extra arguments.
  4. Choose output method — DB::table() with Faker for a self-contained seeder, or Model::factory() if you already have a factory class.
  5. Generate — Click Generate Seeder to create the PHP seeder class.
  6. Copy or Download — Click Copy or Download to save as {Model}Seeder.php.

Tip

Place the generated file in database/seeders/, then run php artisan db:seed --class={Model}Seeder or add a call in DatabaseSeeder.php.

Frequently Asked Questions

What is a Seeder in Laravel?

A Seeder is a PHP class that populates your database with test or default data. Seeders use Faker (a PHP library) to generate realistic fake data. You run them with the php artisan db:seed Artisan command.

What is Faker?

Faker is a PHP library that generates fake data for you — names, emails, addresses, paragraphs, numbers, dates, and more. Laravel includes Faker by default and uses it in factories and seeders.

Should I use DB::table() or Model::factory()?

DB::table() generates a self-contained seeder with inline Faker calls — you don't need a factory class. Model::factory() delegates to the model's factory, which is better if you already have factories defined. For quick prototyping, DB::table() is simpler.

What does "Truncate table" do?

When enabled, the seeder will run DB::table('posts')->truncate() before inserting new records. This clears existing data to avoid duplicates. The foreign key check option ensures truncation doesn't fail on related tables.

Can I generate multiple seeders?

Yes. Generate each seeder separately, then register them all in DatabaseSeeder.php using $this->call([PostSeeder::class, UserSeeder::class]).