cocosmos/filament-quick-add-select
Add a quickAdd() method to any Filament Select with a relationship so users can instantly create and select new options right from the search dropdown. No modals, no interruptions—just type, click "+ Add", and keep working. Supports multiple selects and custom labels.
Architecture fit
Filament\Forms\Components\Select through Laravel's macro system and registers via a service provider with package auto-discovery. No core Filament files are patched, no schema changes, no published assets beyond optional translations — a very small architectural surface area.createOptionForm() modal rather than a replacement; the README positions it explicitly as the fast path, with createOptionForm() retained for models with required attributes.Integration feasibility
composer require, then ->quickAdd() on any relationship Select. Rollout is per-field and opt-in, which makes this trivially pilotable and trivially reversible — the strongest argument in its favor.enabled: closure, custom label: (string template or closure), and resetSearch: for context-sensitive UX (e.g., tagging-style multi-selects want the search preserved; single-select forms may want it cleared).Technical risk
name) is populated. Any model with required non-nullable columns, DB-level constraints, observers, or invariants enforced in booted() will either reject the write or silently persist an incomplete row. This must be triaged per target model, not per package.->quickAdd() without an enabled: guard lets any user who can reach the form create records in the related table. There is no evident built-in policy check. This is the single most important integration constraint and must be a hard coding standard, not a review comment.whereLike. The maintainer is responsive (issue #9 produced both the closure-label fix and resetSearch), but early releases carried defects that a stricter test gate would have caught.Key questions
modifyQueryUsing scopes and multi-tenancy — i.e., can a user create a record into a tenant they don't belong to?creating observers, and validation rules fired on the created record, or is it a raw create()?createOptionForm() or createOptionUsing() — defined precedence?composer test, and does it cover multi-select pivot attachment and authorization-negative cases?Stack fit
createOptionForm().Migration path
Compatibility
BelongsToMany with additional pivot columns before relying on it.createOptionForm() should be verified per field rather than assumed.Sequencing
->quickAdd() carries an enabled: auth()->user()->can('create', Model::class) guard. Enforce in review and, ideally, a static check.createOptionForm().->quickAdd() by reflex.Maintenance
Support
whereLike fix and the resetSearch/closure-label work both trace to issue #9), so a contribution-back path is realistic — but do not treat upstream SLA as a dependency.Scaling
Failure modes
| Failure | Impact | Mitigation |
|---|---|---|
| Model has required attributes | Insert fails or persists incomplete row | Exclude such models; use createOptionForm() |
| Missing authorization guard | Unauthorized record creation / cross-tenant write | Mandatory enabled: policy closure |
| Typo/duplicate records | Master-data pollution, degrading downstream reports | Unique constraint + dedupe job |
| Concurrent creation of same term | Duplicate rows, no error to user | DB unique index; accept-and-resolve UX |
| Filament major upgrade | Macro silently no-ops or errors | Pinted version, upgrade-gate test, fork fallback |
| Missing translation key | Raw key rendered in UI | Publish and review lang/vendor/quick-add/ |
| Case-sensitive search on PostgreSQL | Term appears "not found" when it exists, creating a duplicate | Resolved in 1.1.2; verify on your PG version |
Ramp-up
->quickAdd(), and that the authorization guard is non-optional. Encode both in the conventions doc and in PR review rather than in a wiki nobody reads.Bottom line for the TPM: low-cost, low-risk-to-integrate, moderate-risk-to-operate. Approve for pilot on single-attribute reference tables behind a mandatory authorization guard, with a pin-and-fork contingency for Filament upgrades and a dedupe strategy in place before broadening beyond internal users. Do not adopt for master data carrying business rules or regulatory meaning.
How can I help you explore Laravel packages today?