Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/keving5726/megacreative/llms.txt

Use this file to discover all available pages before exploring further.

Mega Creative includes a full set of database seeders that populate every table with realistic sample data using the Faker library. Running the seeder after migration gives you a fully functional application instance with 100 students, 10 academic programs, and a complete set of geographic and lookup data — no manual data entry required.

Running the Seeder

1

Ensure migrations have already run

The seeders insert rows into tables that must already exist. If you have not yet run migrations, do so first:
php artisan migrate
2

Run the seeder

Seed all tables in one command:
php artisan db:seed
Artisan invokes DatabaseSeeder::run(), which calls each individual seeder in the correct dependency order.
Alternatively, you can wipe the database, re-run all migrations, and seed in a single step:
php artisan migrate:fresh --seed
This is the recommended approach during local development when you want a clean, fully-populated database from scratch.

What Gets Seeded

Seeder ClassMethodOutput
StatusesTableSeederManual DB::insert2 rowsHabilitado, Inhabilitado
SexosTableSeederManual DB::insert2 rowsMasculino, Femenino
CarrerasTableSeederFaker factory10 academic programs with a unique color-based name, a short sentence description, and a random status
PaisesTableSeederFaker factory30 countries with unique Faker-generated country names
EstadosTableSeederFaker factory50 states / provinces with unique Faker-generated names
CiudadesTableSeederFaker factory50 cities with unique Faker-generated names
EstudiantesTableSeederFaker factory100 students with realistic names, a unique email, a random birth date between 20 and 40 years ago, and valid FK references to the rows created above
The Faker-generated geographic data — countries, states, and cities — contains placeholder names drawn from Faker’s built-in locale data. These names are not structured as real geographic hierarchies (a city is not associated with a specific state or country). For a production deployment you should replace the PaisesTableSeeder, EstadosTableSeeder, and CiudadesTableSeeder with curated real-world data and add the appropriate relational links between them.

Seeder Order

The DatabaseSeeder class is the single entry point that Artisan calls. It invokes each seeder class in a specific order that respects foreign key dependencies — for example, StatusesTableSeeder must run before CarrerasTableSeeder because each carrera holds a status_id FK. Below is the complete DatabaseSeeder::run() method as defined in the source:
public function run()
{
    $this->call(StatusesTableSeeder::class);
    $this->call(SexosTableSeeder::class);
    $this->call(CarrerasTableSeeder::class);
    $this->call(PaisesTableSeeder::class);
    $this->call(EstadosTableSeeder::class);
    $this->call(CiudadesTableSeeder::class);
    $this->call(EstudiantesTableSeeder::class);
}
The dependency chain is:
  • statuses must exist before carreras and estudiantes (both hold status_id).
  • sexos must exist before estudiantes (sexo_id).
  • carreras must exist before estudiantes (carrera_id).
  • paises, estados, and ciudades must all exist before estudiantes (pais_id, estado_id, ciudad_id).
EstudiantesTableSeeder is therefore always last.

Individual Seeders

You can run a single seeder class without invoking the full DatabaseSeeder. This is useful when you want to top up one table without touching the others:
php artisan db:seed --class=CarrerasTableSeeder
Any seeder class can be targeted this way:
php artisan db:seed --class=CarrerasTableSeeder
When running individual seeders, you are responsible for ensuring that any tables they depend on are already populated. Running EstudiantesTableSeeder on an empty database will fail with a foreign key constraint violation because the factory assigns random IDs from the ranges 1–2 (statuses, sexos), 1–10 (carreras), 1–30 (paises), and 1–50 (estados, ciudades).

Build docs developers (and LLMs) love