2025-09-24 22:30:28 +09:00
|
|
|
# 논리적 데이터베이스 관계 문서
|
|
|
|
|
|
2025-10-14 22:26:15 +09:00
|
|
|
> **자동 생성**: 2025-10-14 22:24:19
|
|
|
|
|
> **소스**: Eloquent 모델 관계 분석
|
|
|
|
|
|
|
|
|
|
## 📊 모델별 관계 현황
|
|
|
|
|
|
|
|
|
|
### boards
|
|
|
|
|
**모델**: `App\Models\Boards\Board`
|
|
|
|
|
|
|
|
|
|
- **customFields()**: hasMany → `board_settings`
|
|
|
|
|
- **posts()**: hasMany → `posts`
|
|
|
|
|
|
|
|
|
|
### board_comments
|
|
|
|
|
**모델**: `App\Models\Boards\BoardComment`
|
|
|
|
|
|
|
|
|
|
- **post()**: belongsTo → `posts`
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
- **parent()**: belongsTo → `board_comments`
|
|
|
|
|
- **children()**: hasMany → `board_comments`
|
|
|
|
|
|
|
|
|
|
### board_settings
|
|
|
|
|
**모델**: `App\Models\Boards\BoardSetting`
|
|
|
|
|
|
|
|
|
|
- **board()**: belongsTo → `boards`
|
|
|
|
|
|
|
|
|
|
### posts
|
|
|
|
|
**모델**: `App\Models\Boards\Post`
|
|
|
|
|
|
|
|
|
|
- **board()**: belongsTo → `boards`
|
|
|
|
|
- **comments()**: hasMany → `board_comments`
|
|
|
|
|
- **files()**: morphMany → `files`
|
|
|
|
|
|
|
|
|
|
### post_custom_field_values
|
|
|
|
|
**모델**: `App\Models\Boards\PostCustomFieldValue`
|
|
|
|
|
|
|
|
|
|
- **post()**: belongsTo → `posts`
|
|
|
|
|
- **field()**: belongsTo → `board_settings`
|
|
|
|
|
|
|
|
|
|
### categorys
|
|
|
|
|
**모델**: `App\Models\Commons\Category`
|
|
|
|
|
|
|
|
|
|
- **parent()**: belongsTo → `categories`
|
|
|
|
|
- **children()**: hasMany → `categories`
|
|
|
|
|
- **products()**: hasMany → `products`
|
|
|
|
|
- **categoryFields()**: hasMany → `category_fields`
|
|
|
|
|
|
|
|
|
|
### category_fields
|
|
|
|
|
**모델**: `App\Models\Commons\CategoryField`
|
|
|
|
|
|
|
|
|
|
- **category()**: belongsTo → `categories`
|
|
|
|
|
|
|
|
|
|
### category_logs
|
|
|
|
|
**모델**: `App\Models\Commons\CategoryLog`
|
|
|
|
|
|
|
|
|
|
- **category()**: belongsTo → `categories`
|
|
|
|
|
|
|
|
|
|
### category_templates
|
|
|
|
|
**모델**: `App\Models\Commons\CategoryTemplate`
|
|
|
|
|
|
|
|
|
|
- **category()**: belongsTo → `categories`
|
|
|
|
|
|
|
|
|
|
### files
|
|
|
|
|
**모델**: `App\Models\Commons\File`
|
|
|
|
|
|
|
|
|
|
- **uploader()**: belongsTo → `users`
|
|
|
|
|
- **fileable()**: morphTo → `(Polymorphic)`
|
|
|
|
|
|
|
|
|
|
### menus
|
|
|
|
|
**모델**: `App\Models\Commons\Menu`
|
|
|
|
|
|
|
|
|
|
- **parent()**: belongsTo → `menus`
|
|
|
|
|
- **children()**: hasMany → `menus`
|
|
|
|
|
|
|
|
|
|
### tags
|
|
|
|
|
**모델**: `App\Models\Commons\Tag`
|
|
|
|
|
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
|
|
|
|
|
### bom_templates
|
|
|
|
|
**모델**: `App\Models\Design\BomTemplate`
|
|
|
|
|
|
|
|
|
|
- **modelVersion()**: belongsTo → `model_versions`
|
|
|
|
|
- **items()**: hasMany → `bom_template_items`
|
|
|
|
|
|
|
|
|
|
### bom_template_items
|
|
|
|
|
**모델**: `App\Models\Design\BomTemplateItem`
|
|
|
|
|
|
|
|
|
|
- **template()**: belongsTo → `bom_templates`
|
|
|
|
|
|
|
|
|
|
### design_models
|
|
|
|
|
**모델**: `App\Models\Design\DesignModel`
|
|
|
|
|
|
|
|
|
|
- **versions()**: hasMany → `model_versions`
|
|
|
|
|
|
|
|
|
|
### model_versions
|
|
|
|
|
**모델**: `App\Models\Design\ModelVersion`
|
|
|
|
|
|
|
|
|
|
- **model()**: belongsTo → `models`
|
|
|
|
|
- **bomTemplates()**: hasMany → `bom_templates`
|
|
|
|
|
|
|
|
|
|
### estimates
|
|
|
|
|
**모델**: `App\Models\Estimate\Estimate`
|
|
|
|
|
|
|
|
|
|
- **modelSet()**: belongsTo → `categories`
|
|
|
|
|
- **items()**: hasMany → `estimate_items`
|
|
|
|
|
|
|
|
|
|
### estimate_items
|
|
|
|
|
**모델**: `App\Models\Estimate\EstimateItem`
|
|
|
|
|
|
|
|
|
|
- **estimate()**: belongsTo → `estimates`
|
|
|
|
|
|
|
|
|
|
### main_requests
|
|
|
|
|
**모델**: `App\Models\MainRequest`
|
|
|
|
|
|
|
|
|
|
- **flows()**: hasMany → `main_request_flows`
|
|
|
|
|
|
|
|
|
|
### main_request_flows
|
|
|
|
|
**모델**: `App\Models\MainRequestFlow`
|
|
|
|
|
|
|
|
|
|
- **mainRequest()**: belongsTo → `main_requests`
|
|
|
|
|
- **flowable()**: morphTo → `(Polymorphic)`
|
|
|
|
|
|
|
|
|
|
### materials
|
|
|
|
|
**모델**: `App\Models\Materials\Material`
|
|
|
|
|
|
|
|
|
|
- **receipts()**: hasMany → `material_receipts`
|
|
|
|
|
- **lots()**: hasMany → `lots`
|
|
|
|
|
- **files()**: morphMany → `files`
|
|
|
|
|
|
|
|
|
|
### material_inspections
|
|
|
|
|
**모델**: `App\Models\Materials\MaterialInspection`
|
|
|
|
|
|
|
|
|
|
- **receipt()**: belongsTo → `material_receipts`
|
|
|
|
|
- **items()**: hasMany → `material_inspection_items`
|
|
|
|
|
|
|
|
|
|
### material_inspection_items
|
|
|
|
|
**모델**: `App\Models\Materials\MaterialInspectionItem`
|
|
|
|
|
|
|
|
|
|
- **inspection()**: belongsTo → `material_inspections`
|
|
|
|
|
|
|
|
|
|
### material_receipts
|
|
|
|
|
**모델**: `App\Models\Materials\MaterialReceipt`
|
|
|
|
|
|
|
|
|
|
- **material()**: belongsTo → `materials`
|
|
|
|
|
- **inspections()**: hasMany → `material_inspections`
|
|
|
|
|
|
|
|
|
|
### users
|
|
|
|
|
**모델**: `App\Models\Members\User`
|
|
|
|
|
|
|
|
|
|
- **userTenants()**: hasMany → `user_tenants`
|
|
|
|
|
- **userRoles()**: hasMany → `user_roles`
|
|
|
|
|
- **userTenant()**: hasOne → `user_tenants`
|
|
|
|
|
- **userTenantById()**: hasOne → `user_tenants`
|
|
|
|
|
- **tenantsMembership()**: belongsToMany → `tenants`
|
|
|
|
|
- **files()**: morphMany → `files`
|
|
|
|
|
|
|
|
|
|
### user_menu_permissions
|
|
|
|
|
**모델**: `App\Models\Members\UserMenuPermission`
|
|
|
|
|
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
- **menu()**: belongsTo → `menus`
|
|
|
|
|
|
|
|
|
|
### user_roles
|
|
|
|
|
**모델**: `App\Models\Members\UserRole`
|
|
|
|
|
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
- **role()**: belongsTo → `roles`
|
|
|
|
|
|
|
|
|
|
### user_tenants
|
|
|
|
|
**모델**: `App\Models\Members\UserTenant`
|
|
|
|
|
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
|
|
|
|
|
### clients
|
|
|
|
|
**모델**: `App\Models\Orders\Client`
|
|
|
|
|
|
|
|
|
|
- **clientGroup()**: belongsTo → `client_groups`
|
|
|
|
|
- **orders()**: hasMany → `orders`
|
|
|
|
|
|
|
|
|
|
### client_groups
|
|
|
|
|
**모델**: `App\Models\Orders\ClientGroup`
|
|
|
|
|
|
|
|
|
|
- **clients()**: hasMany → `clients`
|
|
|
|
|
|
|
|
|
|
### orders
|
|
|
|
|
**모델**: `App\Models\Orders\Order`
|
|
|
|
|
|
|
|
|
|
- **items()**: hasMany → `order_items`
|
|
|
|
|
- **histories()**: hasMany → `order_histories`
|
|
|
|
|
- **versions()**: hasMany → `order_versions`
|
|
|
|
|
|
|
|
|
|
### order_historys
|
|
|
|
|
**모델**: `App\Models\Orders\OrderHistory`
|
|
|
|
|
|
|
|
|
|
- **order()**: belongsTo → `orders`
|
|
|
|
|
|
|
|
|
|
### order_items
|
|
|
|
|
**모델**: `App\Models\Orders\OrderItem`
|
|
|
|
|
|
|
|
|
|
- **order()**: belongsTo → `orders`
|
|
|
|
|
- **components()**: hasMany → `order_item_components`
|
|
|
|
|
|
|
|
|
|
### order_item_components
|
|
|
|
|
**모델**: `App\Models\Orders\OrderItemComponent`
|
|
|
|
|
|
|
|
|
|
- **orderItem()**: belongsTo → `order_items`
|
|
|
|
|
|
|
|
|
|
### order_versions
|
|
|
|
|
**모델**: `App\Models\Orders\OrderVersion`
|
|
|
|
|
|
|
|
|
|
- **order()**: belongsTo → `orders`
|
|
|
|
|
|
|
|
|
|
### permissions
|
|
|
|
|
**모델**: `App\Models\Permissions\Permission`
|
|
|
|
|
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
|
|
|
|
|
### permission_overrides
|
|
|
|
|
**모델**: `App\Models\Permissions\PermissionOverride`
|
|
|
|
|
|
|
|
|
|
- **permission()**: belongsTo → `permissions`
|
|
|
|
|
|
|
|
|
|
### roles
|
|
|
|
|
**모델**: `App\Models\Permissions\Role`
|
|
|
|
|
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
- **menuPermissions()**: hasMany → `role_menu_permissions`
|
|
|
|
|
- **userRoles()**: hasMany → `user_roles`
|
|
|
|
|
|
|
|
|
|
### role_menu_permissions
|
|
|
|
|
**모델**: `App\Models\Permissions\RoleMenuPermission`
|
|
|
|
|
|
|
|
|
|
- **role()**: belongsTo → `roles`
|
|
|
|
|
- **menu()**: belongsTo → `menus`
|
|
|
|
|
|
|
|
|
|
### common_codes
|
|
|
|
|
**모델**: `App\Models\Products\CommonCode`
|
|
|
|
|
|
|
|
|
|
- **parent()**: belongsTo → `common_codes`
|
|
|
|
|
- **children()**: hasMany → `common_codes`
|
|
|
|
|
|
|
|
|
|
### parts
|
|
|
|
|
**모델**: `App\Models\Products\Part`
|
|
|
|
|
|
|
|
|
|
- **category()**: belongsTo → `common_codes`
|
|
|
|
|
- **partType()**: belongsTo → `common_codes`
|
|
|
|
|
|
|
|
|
|
### price_historys
|
|
|
|
|
**모델**: `App\Models\Products\PriceHistory`
|
|
|
|
|
|
|
|
|
|
- **clientGroup()**: belongsTo → `client_groups`
|
|
|
|
|
|
|
|
|
|
### products
|
|
|
|
|
**모델**: `App\Models\Products\Product`
|
|
|
|
|
|
|
|
|
|
- **category()**: belongsTo → `categories`
|
|
|
|
|
- **componentLines()**: hasMany → `product_components`
|
|
|
|
|
- **parentLines()**: hasMany → `product_components`
|
|
|
|
|
- **children()**: belongsToMany → `products`
|
|
|
|
|
- **parents()**: belongsToMany → `products`
|
|
|
|
|
- **files()**: morphMany → `files`
|
|
|
|
|
|
|
|
|
|
### product_components
|
|
|
|
|
**모델**: `App\Models\Products\ProductComponent`
|
|
|
|
|
|
|
|
|
|
- **parentProduct()**: belongsTo → `products`
|
|
|
|
|
- **product()**: belongsTo → `products`
|
|
|
|
|
- **material()**: belongsTo → `materials`
|
|
|
|
|
|
|
|
|
|
### lots
|
|
|
|
|
**모델**: `App\Models\Qualitys\Lot`
|
|
|
|
|
|
|
|
|
|
- **material()**: belongsTo → `materials`
|
|
|
|
|
- **sales()**: hasMany → `lot_sales`
|
|
|
|
|
|
|
|
|
|
### lot_sales
|
|
|
|
|
**모델**: `App\Models\Qualitys\LotSale`
|
|
|
|
|
|
|
|
|
|
- **lot()**: belongsTo → `lots`
|
|
|
|
|
|
|
|
|
|
### departments
|
|
|
|
|
**모델**: `App\Models\Tenants\Department`
|
|
|
|
|
|
|
|
|
|
- **parent()**: belongsTo → `departments`
|
|
|
|
|
- **children()**: hasMany → `departments`
|
|
|
|
|
- **departmentUsers()**: hasMany → `department_user`
|
|
|
|
|
- **users()**: belongsToMany → `users`
|
|
|
|
|
- **permissionOverrides()**: morphMany → `permission_overrides`
|
|
|
|
|
|
|
|
|
|
### payments
|
|
|
|
|
**모델**: `App\Models\Tenants\Payment`
|
|
|
|
|
|
|
|
|
|
- **subscription()**: belongsTo → `subscriptions`
|
|
|
|
|
|
|
|
|
|
### department_users
|
|
|
|
|
**모델**: `App\Models\Tenants\Pivots\DepartmentUser`
|
|
|
|
|
|
|
|
|
|
- **department()**: belongsTo → `departments`
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
|
|
|
|
|
### plans
|
|
|
|
|
**모델**: `App\Models\Tenants\Plan`
|
|
|
|
|
|
|
|
|
|
- **subscriptions()**: hasMany → `subscriptions`
|
|
|
|
|
|
|
|
|
|
### setting_field_defs
|
|
|
|
|
**모델**: `App\Models\Tenants\SettingFieldDef`
|
|
|
|
|
|
|
|
|
|
- **tenantSettings()**: hasMany → `tenant_field_settings`
|
|
|
|
|
|
|
|
|
|
### subscriptions
|
|
|
|
|
**모델**: `App\Models\Tenants\Subscription`
|
|
|
|
|
|
|
|
|
|
- **tenant()**: belongsTo → `tenants`
|
|
|
|
|
- **plan()**: belongsTo → `plans`
|
|
|
|
|
- **payments()**: hasMany → `payments`
|
|
|
|
|
|
|
|
|
|
### tenants
|
|
|
|
|
**모델**: `App\Models\Tenants\Tenant`
|
|
|
|
|
|
|
|
|
|
- **plan()**: belongsTo → `plans`
|
|
|
|
|
- **subscription()**: belongsTo → `subscriptions`
|
|
|
|
|
- **userTenants()**: hasMany → `user_tenants`
|
|
|
|
|
- **roles()**: hasMany → `roles`
|
|
|
|
|
- **userRoles()**: hasMany → `user_roles`
|
|
|
|
|
- **users()**: belongsToMany → `users`
|
|
|
|
|
- **files()**: morphMany → `files`
|
|
|
|
|
|
|
|
|
|
### tenant_field_settings
|
|
|
|
|
**모델**: `App\Models\Tenants\TenantFieldSetting`
|
|
|
|
|
|
|
|
|
|
- **fieldDef()**: belongsTo → `setting_field_defs`
|
|
|
|
|
- **optionGroup()**: belongsTo → `tenant_option_groups`
|
|
|
|
|
|
|
|
|
|
### tenant_option_groups
|
|
|
|
|
**모델**: `App\Models\Tenants\TenantOptionGroup`
|
|
|
|
|
|
|
|
|
|
- **values()**: hasMany → `tenant_option_values`
|
|
|
|
|
|
|
|
|
|
### tenant_option_values
|
|
|
|
|
**모델**: `App\Models\Tenants\TenantOptionValue`
|
|
|
|
|
|
|
|
|
|
- **group()**: belongsTo → `tenant_option_groups`
|
|
|
|
|
|
|
|
|
|
### tenant_user_profiles
|
|
|
|
|
**모델**: `App\Models\Tenants\TenantUserProfile`
|
|
|
|
|
|
|
|
|
|
- **user()**: belongsTo → `users`
|
|
|
|
|
- **department()**: belongsTo → `departments`
|
2025-09-24 22:30:28 +09:00
|
|
|
|