skills/smithery.ai/laravel-seeder-organization

laravel-seeder-organization

Installation
SKILL.md

Overview

Seeders in this repo should respect an environment split: shared seeders that apply everywhere and local-only helpers that run when app()->environment('local') is true. DatabaseSeeder already models that flow, so a skill can walk through adding new seeders following the same guardrails.

Directory Layout

  • database/seeders/ – entry point DatabaseSeeder.php plus environment-neutral seeders.
  • database/seeders/Dummy/ – local-only helpers (e.g., LocalUserSeeder, HistoricalInvoiceSeeder) that require development data.

Implementation Steps

  1. Seed shared data: write a seeder in database/seeders and register it in DatabaseSeeder::run. Use firstOrCreate, updateOrCreate, or upsert so repeated runs reconcile data without duplication.
  2. Keep local helpers separate: place dev-only seeders in a Dummy subnamespace (or equivalent) and invoke them inside if (app()->environment('local')) so they never hit staging/production.
  3. Structure DatabaseSeeder clearly: call shared seeders in one block, then wrap the local-only calls in the environment guard, avoiding duplicate registrations (e.g., do not list the same seeder twice).

Examples

DatabaseSeeder layout

namespace Database\Seeders;

use Illuminate\Database\Seeder;
Installs
1
First Seen
Apr 14, 2026
laravel-seeder-organization from smithery.ai