Skip to content

Seeding

Tachi Kit has three seeders in database/seeders/:

Seeder Runs Creates
DatabaseSeeder php artisan db:seed Calls the two below
RolePermissionSeeder Always Every permission, plus the superadmin, admin and user roles with their permissions
DemoUserSeeder Outside production only Four demo staff accounts and 50 members
public function run(): void
{
$this->call(RolePermissionSeeder::class);
if (app()->isProduction()) {
return;
}
$this->call(DemoUserSeeder::class);
}
  • Creates one permission per Permission enum case.
  • Creates the system roles. superadmin gets every permission (PermissionEnum::values()); admin gets the user-management permissions; user gets none.
  • Is idempotent: it uses firstOrCreate everywhere, so running it again never duplicates or fails. Re-run it after adding a permission:
Terminal window
php artisan db:seed --class=RolePermissionSeeder

It never removes permissions or revokes them from roles. Do removals in a migration or on the Roles page.

Seeds only when the users table is empty, so it never touches real data:

Email Role
superadmin@tachikit.com superadmin
superadmin2@tachikit.com superadmin
administrator@tachikit.com admin
admin@tachikit.com admin

Plus 50 user-role members with random names, created over the last 12 months (for the dashboard chart), about 10% of them inactive. Every password is password.

php artisan db:seed --force in production only runs RolePermissionSeeder. Create your first account with tachi:superadmin.

Edit DemoUserSeeder: change the accounts, the member count, or add demo records for your own models. Use the factory states (asAdmin(), asSuperadmin(), asUser(), inactive(), withRole(...)) described in Testing.

Create a seeder with php artisan make:seeder and add it to DatabaseSeeder. Put it before the production check if the data is needed everywhere (like lookup tables), and inside DemoUserSeeder or after the check if it’s only demo content.