@@ -66,6 +66,10 @@ mysql:
6666 MYSQL_ROOT_PASSWORD : password
6767` ` `
6868
69+ ### Docker Setup Image
70+
71+ Please read laravel sail official document
72+
6973---
7074
7175## Entity Relationship Diagram (ERD)
@@ -81,7 +85,6 @@ erDiagram
8185 users }o--|| passport_types : belongs_to
8286 users ||--o{ user_login_logs : has
8387 users ||--o{ admission_test_orders : creates
84- users ||--o{ contact_has_verifications : creates
8588 users ||--o{ reset_password_logs : has
8689 users ||--o{ sessions : has
8790
@@ -107,30 +110,23 @@ erDiagram
107110
108111 %% Payment & Products
109112 admission_test_orders }o--|| users : ordered_by
110- admission_test_orders }o--|| stripe_customers : " via (polymorphic)"
111113 admission_test_orders }o--|| other_payment_gateways : " via (polymorphic)"
112114 admission_test_products ||--o{ admission_test_prices : has
113115
114116 %% Stripe Integration
115117 stripe_customers }o--|| users : " for (polymorphic)"
116118
117119 %% Permission System (Spatie)
118- permissions ||--o{ module_permissions : has
119- modules ||--o{ module_permissions : has
120- module_permissions }o--|| permissions : belongs_to
121- module_permissions }o--|| modules : belongs_to
122- roles ||--o{ team_roles : has
123- teams ||--o{ team_roles : has
124- team_roles }o--|| roles : belongs_to
125- team_roles }o--|| roles : belongs_to
120+ team_roles }o--|| teams : has
121+ team_roles }o--|| roles : has
122+ module_permissions }o--|| modules : has
123+ module_permissions }o--|| permissions : has
126124 teams }o--|| team_types : has_type
127125
128126 %% Permission Pivot Tables
129127 users }o--o{ module_permissions : model_has_module_permissions
130128 users }o--o{ team_roles : model_has_team_roles
131- roles }o--o{ module_permissions : team_roles_has_permissions
132- teams }o--o{ roles : team_roles
133- modules }o--o{ permissions : module_permissions
129+ team_roles }o--o{ module_permissions : team_roles_has_module_permissions
134130
135131 %% CMS & Navigation
136132 site_pages ||--o{ site_contents : has
@@ -505,7 +501,7 @@ Primary user table storing user account information.
505501- ` id ` - Primary key
506502- ` username ` - Unique username (max 320 chars)
507503- ` password ` - Hashed password
508- - ` family_name ` , ` middle_name ` , ` given_name ` - User's full name
504+ - ` family_name ` , ` middle_name ` , ` given_name ` - User's adorned name
509505- ` gender_id ` - Foreign key to ` genders ` table
510506- ` passport_type_id ` - Foreign key to ` passport_types ` table
511507- ` passport_number ` - User's identification number
@@ -515,9 +511,9 @@ Primary user table storing user account information.
515511** Relationships:**
516512
517513- ` belongsTo ` : Gender, PassportType
518- - ` hasMany ` : UserHasContact, UserLoginLog , AdmissionTestOrder
514+ - ` hasMany ` : UserLoginLog, UserHasContact, ResetPasswordLog , AdmissionTestOrder
519515- ` hasOne ` : Member
520- - ` belongsToMany ` : AdmissionTest (via proctors/candidates), Permissions, Roles
516+ - ` belongsToMany ` : AdmissionTest (via proctors/candidates), ModulePermission, TeamRole
521517
522518#### ` members `
523519
@@ -720,9 +716,9 @@ Categories of teams.
720716
721717#### Pivot Tables:
722718
723- - ` model_has_permissions ` - Polymorphic: User/Model → Permissions
724- - ` model_has_roles ` - Polymorphic: User/Model → Roles
725- - ` role_has_permissions ` - Role → Permissions
719+ - ` model_has_module_permissions ` - Polymorphic: User/Model → Module Permissions
720+ - ` model_has_team_roles ` - Polymorphic: User/Model → Team Roles
721+ - ` team_role_has_module_permissions ` - Team Role → Module Permissions
726722- ` team_roles ` - Team → Roles (custom)
727723- ` module_permissions ` - Module → Permissions (custom)
728724
@@ -847,17 +843,19 @@ Area
847843### Permission System
848844
849845```
850- Module
851- └─ hasMany: Permission
852- └─ belongsToMany: Role
853-
854- Team
855- ├─ belongsTo: TeamType
856- └─ belongsToMany: Role
857-
858- User
859- ├─ hasMany: Permission (via model_has_permissions)
860- └─ hasMany: Role (via model_has_roles)
846+ ModulePermission(模封權限)
847+ ├─ belongsTo: Module(模封)
848+ ├─ belongsTo: Permission(權限)
849+ └─ belongsToMany: TeamRole(團隊角色)
850+
851+ TeamRole(團隊角色)
852+ ├─ belongsTo: Role(角色)
853+ └─ belongsTo: Team(團隊)
854+ └─ belongsTo: TeamType(團隊類型)
855+
856+ User(用戶)
857+ ├─ hasMany: ModulePermission(模封權限)通過 model_has_module_permissions
858+ └─ hasMany: TeamRole(團隊角色)通過 model_has_team_roles
861859```
862860
863861---
@@ -1283,9 +1281,10 @@ When adding new migrations:
12831281
128412821. Follow Laravel naming conventions: `YYYY_MM_DD_HHMMSS_create_table_name.php`
128512832. Include both `up()` and `down()` methods
1286- 3. Add foreign key constraints where appropriate
1287- 4. Update this README with new table documentation
1288- 5. Create corresponding factory if needed for testing
1284+ 3. Strongly recommend using command of `php artisan make:migration create_{create table name}_table` to generate the migration file
1285+ 4. Add foreign key constraints where appropriate
1286+ 5. Update this README with new table documentation
1287+ 6. Create corresponding factory if needed for testing
12891288
12901289---
12911290
0 commit comments