split seeders by domain entity

Replaces the laravel-default scaffold seeder with one file per
domain (AdminUser, User, Post, Comment) plus a config/seed.php
to source admin credentials from env. DatabaseSeeder is now a
pure orchestrator that calls the sub-seeders in dependency
order.
This commit is contained in:
Yisroel Baum 2026-05-06 22:38:14 +03:00
parent c55852ec12
commit beb4ddd1e9
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 213 additions and 9 deletions

View file

@ -2,7 +2,6 @@
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@ -10,16 +9,13 @@ class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
$this->call([
AdminUserSeeder::class,
UserSeeder::class,
PostSeeder::class,
CommentSeeder::class,
]);
}
}