Component Variants
SearchCombobox
Standalone component for use outside of forms.CoreFormSearchCombobox
Integrated with Inertia forms for automatic form state management.Multiple ID Support
The SearchQueryBuilder now supports multiple IDs for future-proofing multi-select functionality. The implementation always useswhereIn for consistency - single values are automatically converted to arrays with one element.
Note: Missing values are silently filtered out rather than throwing exceptions, making the API more resilient to stale or invalid IDs.
Backend Implementation
Default Keying Behavior
- Regular Eloquent models: Uses
$model->getKey()(typically the primary key) - Domain objects: Uses
$model->getObjectIdKeyName()value - Custom: Override with
->keyBy(fn($model) => $model->your_key)
Return Types
Always returns a keyedCollection<ObjectData> (or keyed array in JSON):
- Single value input: Returns keyed collection with one item (or empty if not found)
- Multiple values input: Returns keyed collection with found items (missing values are silently filtered out)
DomainObjectSearchQueryBuilder automatically handles this pattern in its default implementation.
Excluding IDs
PassexcludedIds to hide specific items from search results — useful for preventing duplicate selections when an item is already added.
exclude[] query parameters to the backend. The SearchQueryBuilder automatically applies a whereNotIn constraint using these IDs against the model’s id column by default.
If the model uses a different key column, call excludeBy() on the builder:
Note: Excluded IDs are only applied to search/listing results, not when fetching the currently selected item’s display label.
Usage Patterns
1. Domain Object Search (Recommended)
Use the domain object’s built-in global search by passing the fully qualified class name. Model must implementDomainObjectContract (typically via HasDomainObject trait) and use Searchable for Scout integration.
2. Custom Domain Object Search
When you need additional filtering beyond the model’s default search behavior, create a custom controller withDomainObjectSearchQueryBuilder.
Custom Controller
Route
Frontend Usage
3. Non-Domain Object Search
For models that don’t implement domain objects (e.g., third-party data, external APIs), useSearchQueryBuilder with custom mapping.