Getting Started

Seeders

Introduction

This is a Guide to use Seeders in VaahCMS.

Basically Seeder is a class used to seed the database with data. In VaahCMS All the seed classes are stored in the Database\Seeds directory.
Follow below image for reference: seeder directory


Types of Seeders in VaahCMS

There are two types of Seeders in VaahCMS:

  1. DatabaseTableSeeder
  2. SampleDataTableSeeder

Follow below image for references: types of seeder We will get to know about both these Seeders one by one.

1. DatabaseTableSeeder :

This Seeder is used to seed the database with necessary data. All the necessary functions, which are required for the module and theme are placed inside run method of DatabaseTableSeeder.
Follow below image for reference:

DatabaseTableSeeder

The run method of DatabaseTableSeeder is called whenever any module or theme is activated by the user and it seeds the database with the data.


2. SampleDataTableSeeder :

SampleDataTableSeeder is used to seed test data into the database for the module or the theme. Whenever we want to insert test data into the database we can use run method of this Seeder class to seed the test data. To use SampleDataTableSeeder we need to click on import sample data for the particular module or the theme.
Follow below image for reference:

import sample data

Once we click on this Import Sample Data button run method of SampleDataTableSeeder is called and data is seeded into the database.



Copyright © 2024