What is seed in laravel?

Laravel provides a tool to add dummy data to our databases automatically that call it seeding.

With the help of database seeder, we can add simply testing data on our database table. Database seed is beneficial because testing with various data allows you to detect bugs you otherwise would have overlooked likely. We have to make one-time seeder with some dummy data directly; that way we can reuse when you deploy the project first time. We can make seeder after migration of the table.

All classes in the seed are placed in the directory database/seeds

How to create database seeder

To generate a seeder, run the make:seeder Artisan command. All seeders generated by the laravel will be placed in the database/seeds directory:

php artisan make:seeder AdminTableSeeder

Suggest An Answer

No suggestions avaliable!

Latest post from Laravel Interview Questions

Ask Question