Data model — Set
A Set is a named grouping of Locations used for category-based filtering in the Finder widget. In the product UI, Sets are labelled “Categories” — the underlying DB table and model use set/sets.
⚠️ Warning: The UI term is “Category” / “Categories”. Code, DB table names, API endpoints, and this documentation use “Set”. Do not use both terms interchangeably in code or error messages — pick one per context.
Table: sets
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | bigint (auto-increment) | no | Primary key |
| title | varchar | no | Display name shown in the Finder widget’s category filter |
| description | text | yes | Optional internal description |
| created_at | timestamp | no | Laravel auto-managed |
| updated_at | timestamp | no | Laravel auto-managed |
Relations
- belongsToMany
Location— viaset_locationpivot (set_id,location_id). The locations that belong to this category. - belongsToMany
Map— viamap_setpivot. The maps this Set is attached to. - belongsToMany
Workspace— viaset_workspacepivot (with timestamps). Scopes the Set to one or more workspaces. - belongsToMany
User— viaset_userpivot (owners). Returns onlyusers.idfor performance.
Set vs. Map distinction
| Set (Category) | Map | |
|---|---|---|
| Purpose | Groups locations by type/category for filtering | Container that backs a Finder and holds its location scope |
| Widget surface | Drives the “Categories” filter dropdown | Not directly visible; defines what locations appear |
| Created by | User explicitly in the dashboard | Auto-created when a Finder is created |
| DB table | sets | maps |
A Map has many Sets; a Set can appear on many Maps. When a visitor filters by category in the widget, they are filtering by Set membership.
Computed / virtual attributes
None. No $appends, no JSON casts, no overridden toArray.
Cross-links
- Map data model — Maps attach Sets
- Location data model — Locations belong to Sets
- Finder data model — Finders surface Sets via their backing Map
- API reference — Sets