ποΈ Database Models
| {: .hi | π Collection | Content | Collections, exhibitions and galleries | hlight } |
This do π¨ Workshop People Workshops and production studios Β Β π€ User System Application user accounts umentation provides a comprehensive overview of all database models in the application, their properties, relationships, and usage patterns after the recent model simplification initiative.
π Overview
- π Total Models: 28
- π§ Common Features:
- π All models use UUIDs (except Language, Country, User)
- π·οΈ Most models have
internal_nameandbackward_compatibilityfields - π Relationships are defined using Eloquent ORM best practices
- π Translations are handled via dedicated translation models
- π Many models support hierarchical and many-to-many relationships
π― Key Model Categories
π Geographic Models
- π Address, Location, Province: Represent geographical entities, each with translation models
π₯ People & Organizations
- π¨ Artist, Author, Partner: Represent people/entities, with relationships to items and collections
π¦ Core Content Models (SIMPLIFIED)
- ποΈ Item: Unified model for objects and monuments with hierarchical support
- π Collection: Unified model for collections, exhibitions, and galleries (type-based)
- π¨ Theme: Thematic groupings with collection relationships
πΌοΈ Media Models (RESTRUCTURED)
- πΈ ItemImage: Direct item-to-image relationships with display ordering
- πΌοΈ ImageUpload, AvailableImage: Core image storage and metadata management
π·οΈ Classification & Metadata
- π Tag: Item tagging system
- ποΈ Context: Organizational contexts (museums, institutions)
π€ System Models
- π User: Standard Laravel user model
- π Language, Country: Use ISO codes as primary keys
π Relationship Types
| Type | Icon | Description | Example |
|---|---|---|---|
| BelongsTo | β¬οΈ | Foreign key relationships | Item β Partner |
| HasMany | β¬οΈ | One-to-many relationships | Item β ItemImage |
| BelongsToMany | βοΈ | Many-to-many relationships | Collection β Item |
| Self-Referential | π | Hierarchical relationships | Item β Parent Item |
π Translation System
- π£οΈ Most core models have corresponding translation models (e.g., ItemTranslation, CollectionTranslation)
- π Translation models include language-specific display names and descriptions
- π― Supports multi-language content delivery with context awareness
βοΈ Key Architectural Changes
π Model Simplification Benefits
- π Reduced Complexity: From 37+ models to 28 focused models
- π― Unified Structure: Single Item model with hierarchical support
- π Type-Based Design: Collection model handles collections/exhibitions/galleries via type field
- πΌοΈ Direct Relationships: ItemImage provides direct item-to-image relationships with ordering
- β‘ Better Performance: Eliminated polymorphic relationships for clearer, faster queries
π Scopes & Filtering
- π Enhanced scoping system with type-based filtering (e.g.,
objects(),exhibitions()) - β‘ Optimized query performance through strategic relationship loading
- ποΈ Hierarchical scopes for parent/child item relationships
π οΈ Traits & Patterns
- π Consistent use of
HasFactoryandHasUuidstraits - π Standardized validation patterns across all models
- π§ Enhanced business logic methods for common operations
- π Built-in security and validation features
π Complete Models Index
Click any model name below to view its detailed documentation with properties, relationships, and usage examples.
π€ Current Model List (28 Models)
| Model | Category | Description |
|---|---|---|
| π Address | Geographic | Physical addresses with country relationships |
| π AddressTranslation | Translation | Multi-language address translations |
| π¨ Artist | People | Artists who create items in collections |
| βοΈ Author | People | Authors of written content |
| πΌοΈ AvailableImage | Media | Available images for item attachment |
| οΏ½ Collection | Content | ENHANCED: Collections, exhibitions & galleries (unified) |
| π CollectionTranslation | Translation | Multi-language collection content |
| π Contact | Communication | Contact information storage |
| π ContactTranslation | Translation | Multi-language contact labels |
| βοΈ Context | Configuration | Application context settings |
| πΊοΈ Country | Geographic | Countries using ISO 3166-1 codes |
| οΏ½ ImageUpload | Media | Uploaded image metadata and processing |
| ποΈ Item | Content | Objects and monuments with hierarchical support |
| πΈ ItemImage | Media | Item-to-image relationships with ordering |
| π ItemTranslation | Translation | Multi-language item content |
| π Language | Configuration | Supported languages (ISO 639-3 codes) |
| οΏ½ Location | Geographic | Specific geographic locations |
| π LocationTranslation | Translation | Multi-language location names |
| οΏ½ Partner | Organization | Institutional partners and owners |
| π Project | Management | Project organization and management |
| οΏ½οΈ Province | Geographic | Administrative provinces and regions |
| π ProvinceTranslation | Translation | Multi-language province names |
| οΏ½οΈ Tag | Classification | Content tagging and categorization |
| π― Theme | Content | Thematic groupings with collection relationships |
| π ThemeTranslation | Translation | Multi-language theme content |
| οΏ½ User | System | Application user accounts |
| οΏ½ Workshop | People | Workshops and production studios |
π Recent Model Changes
β Models Added/Enhanced
- πΈ ItemImage: New model for direct item-to-image relationships with display ordering
- ποΈ Item: Enhanced with
typefield (object/monument) and hierarchicalparent_idsupport - π Collection: Enhanced with
typefield (collection/exhibition/gallery) replacing 3 separate models
β Models Removed
π Detail: Functionality integrated into Item modelπΈ Picture: Replaced by ItemImage model with better relationship designοΏ½οΈ Exhibition: Merged into Collection model (type=βexhibitionβ)πΌοΈ Gallery: Merged into Collection model (type=βgalleryβ)π Galleryable: No longer needed with simplified relationshipsπ€ GalleryPartner: No longer needed with unified Collection modelTranslation models: Removed for Gallery, Exhibition, Detail, Picture
π― Benefits of Simplification
- π 37% Reduction: From 37+ models to 28 focused models
- β‘ Better Performance: Eliminated polymorphic relationships
- π― Clearer Logic: Type-based design instead of separate models
- π§ Enhanced APIs: Simplified endpoints with consistent patterns
- π Better Documentation: Focused, comprehensive model docs | π€ User | System | Application users | | π¨ Workshop | Content | Workshop information |
π‘ Tip: Use your browserβs search function (Ctrl+F / Cmd+F) to quickly find specific models in this list.
For an overview of model relationships and architecture, see the summary above.