refactor(seeders): move DevSeeder to new form-builder structure
Adds UserObserver::created() that firstOrCreate's a user_profiles row for every User. Registered in AppServiceProvider alongside PersonObserver. Covers DevSeeder (3 scattered User::create sites: DatabaseSeeder super admin, DevSeeder org staff, DevSeeder volunteer users) and all future creation paths (invite/register/import) with zero per-caller boilerplate. New FormBuilderDevSeeder seeder class holds canonical 16-field registration template (borrowed from the legacy RegistrationFieldTemplateService list so test data stays recognisable). Produces per-org: - 16 form_templates (system, schema_snapshot per ARCH §4.6.1) - 1 FormSchema per event (event_registration, owner=event, draft_single mode, is_published mirrors event.status lifecycle) - 16 FormFields per schema - 1 FormSubmission per person whose status ∈ applied/approved/no_show (same rule as MigrateLegacyFormsData), with 6 realistic FormValues each DevSeeder::run() now wraps the whole seed body in ActivityLog::suppressed(...) so the ~80 field creates + ~277 submission lifecycle triggers don't flood activity_log. Also removes the legacy RegistrationFieldTemplateService::seedSystemTemplates call — the 16 system templates now land directly in form_templates. Post-seed totals (dev DB): 5 form_schemas, 80 form_fields, 277 form_submissions, 1662 form_values, 16 form_templates, 270 user_profiles (1:1 with users). forms:verify-data-integrity on freshly seeded DB: exit 0. php artisan test: 910/910. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ use App\Models\FormBuilder\FormValue;
|
||||
use App\Models\VolunteerAvailability;
|
||||
use App\Observers\FormBuilder\FormValueObserver;
|
||||
use App\Observers\PersonObserver;
|
||||
use App\Observers\UserObserver;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
@@ -97,6 +98,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
]);
|
||||
|
||||
Person::observe(PersonObserver::class);
|
||||
User::observe(UserObserver::class);
|
||||
FormValue::observe(FormValueObserver::class);
|
||||
|
||||
ResetPassword::createUrlUsing(function ($user, string $token) {
|
||||
|
||||
Reference in New Issue
Block a user