Import Target Registry
Contract for registering importable models the commit engine and wizard can target, keyed by target model slug.
Overview
App\Services\Imports\Commit\ImportTargetRegistry holds every model the import engine can commit into. Core targets register at boot; plugins add theirs through the registrar's importableModel() seam (P6-22).
Public surface
| Method | Purpose |
|---|---|
register() |
Register one ImportTarget (core or plugin ImportableModelContract) |
has() |
Whether a target model slug is registered |
wiredSlugs() |
Slugs with full commit wiring |
all() |
Every registered target |
wizardOptions() |
Label/value pairs for the wizard's target selector |
get() |
Resolve one target by model slug |
Accepted definition shape
Targets implement App\Contracts\Imports\ImportTarget (core) or App\Contracts\Imports\ImportableModelContract (plugins; optionally SupportsPolymorphicImport). The contract surface: modelSlug() + label() identify the target; fields() exposes the mappable schema; defaultDuplicateFields() and findDuplicate() drive conflict detection; validate() runs per-row checks; create() and update() are the action-class commit paths — the commit engine only ever writes through them (update() honours fill-empty-only mode).
Worked example
use App\Services\Imports\Commit\ImportTargetRegistry;
$registry = app(ImportTargetRegistry::class);
$registry->register($myImportableModel);
$options = $registry->wizardOptions(); // wizard target dropdown
$target = $registry->get('accounts'); // commit-engine resolution