# 林口新創園區法律諮詢平台 Schema Documentation
## Table: `consultation_times`
### Description:
諮詢時段
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `law_firm_id` | BIGINT UNSIGNED | Not null | | 事務所id |
| `date` | DATE | Not null | | 日期 |
| `location` | VARCHAR(255) | Not null | | 地點 |
| `period_1` | TINYINT | Not null | | 時段1 |
| `period_2` | TINYINT | Not null | | 時段2 |
| `period_3` | TINYINT | Not null | | 時段3 |
| `period_4` | TINYINT | Not null | | 時段4 |
| `period_5` | TINYINT | Not null | | 時段5 |
| `period_6` | TINYINT | Not null | | 時段6 |
| `period_7` | TINYINT | Not null | | 時段7 |
| `period_8` | TINYINT | Not null | | 時段8 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
| `period_9` | TINYINT | Not null | | 時段9 |
| `period_10` | TINYINT | Not null | | 時段10 |
| `period_11` | TINYINT | Not null | | 時段11 |
| `period_12` | TINYINT | Not null | | 時段12 |
| `period_13` | TINYINT | Not null | | 時段13 |
| `period_14` | TINYINT | Not null | | 時段14 |
| `period_15` | TINYINT | Not null | | 時段15 |
| `period_16` | TINYINT | Not null | | 時段6 |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
| `consultation_times_law_firm_id_index` | `law_firm_id` | INDEX | |
## Table: `consultations`
### Description:
預約諮詢
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `consulting_type_id` | BIGINT UNSIGNED | Not null | | 諮詢類別id |
| `law_firm_id` | BIGINT UNSIGNED | Not null | | 事務所id |
| `consultation_time` | DATETIME | Not null | | 諮詢時間 |
| `serial_number` | VARCHAR(255) | Not null | | 預約序號 |
| `name` | VARCHAR(255) | Not null | | 名字 |
| `company` | VARCHAR(255) | Not null | | 公司 |
| `phone` | VARCHAR(255) | | NULL | 電話 |
| `email` | VARCHAR(255) | Not null | | email |
| `content` | TEXT | Not null | | 內容 |
| `status` | TINYINT | Not null | | 狀態 |
| `canceled_at` | DATETIME | | NULL | 取消時間 |
| `location` | TEXT | Not null | | 地點 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
| `consultations_consulting_type_id_index` | `consulting_type_id` | INDEX | |
| `consultations_law_firm_id_index` | `law_firm_id` | INDEX | |
## Table: `consulting_types`
### Description:
諮詢種類
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `name` | VARCHAR(255) | Not null | | 名稱 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `law_firms`
### Description:
事務所
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `name` | TEXT | Not null | | 名稱 |
| `image` | VARCHAR(255) | Not null | | logo |
| `url` | TEXT | Not null | | 官網 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
| `consulting_type_id` | BIGINT UNSIGNED | Not null | 諮詢類別id | |
| `description` | TEXT | | NULL | 簡介 |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `model_has_roles`
### Description:
使用者角色
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `role_id` | BIGINT UNSIGNED | Primary, Not null | | 角色id |
| `model_type` | VARCHAR(255) | Primary, Not null | | 使用者類型 |
| `model_id` | BIGINT UNSIGNED | Primary, Not null | | 使用者id|
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `role_id`, `model_id`, `model_type` | PRIMARY | |
| `model_has_roles_model_id_model_type_index` | `model_id`, `model_type` | INDEX | |
## Table: `options`
### Description:
問卷選項
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `question_id` | BIGINT UNSIGNED | Not null | | 問卷id |
| `title` | TEXT | Not null | | 標題 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
| `options_question_id_index` | `question_id` | INDEX | |
## Table: `permissions`
### Description:
權限
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `name` | VARCHAR(255) | Not null | | 名稱 |
| `guard_name` | VARCHAR(255) | Not null | | 種類 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `questionnaires`
### Description:
問卷結果
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `result` | TEXT | Not null | | 結果 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
| `serial_number` | VARCHAR(255) | | NULL | 序號 |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `questions`
### Description:
滿意度問卷
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `type` | TINYINT | Not null | | 類型 |
| `title` | TEXT | Not null | | 標題 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
| `is_required` | TINYINT(1) | Not null | | 是否必填 |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `role_has_permissions`
### Description:
角色權限
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `permission_id` | BIGINT UNSIGNED | Primary, Not null | | 權限id |
| `role_id` | BIGINT UNSIGNED | Primary, Not null | | 角色id |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `permission_id`, `role_id` | PRIMARY | |
| `role_has_permissions_role_id_foreign` | `role_id` | INDEX | |
## Table: `roles`
### Description:
角色
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `name` | VARCHAR(255) | Not null | | 名稱 |
| `guard_name` | VARCHAR(255) | Not null | | 種類 |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
## Table: `users`
### Description:
使用者
### Columns:
| Column | Data Type | Attributes | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | BIGINT UNSIGNED | Primary, Auto increment, Not null | | |
| `name` | VARCHAR(255) | Not null | | 名字 |
| `email` | VARCHAR(255) | Not null | | email |
| `email_verify_token` | VARCHAR(255) | | NULL | email 驗證 token |
| `email_verified_at` | TIMESTAMP | | NULL | email 驗證時間 |
| `avatar` | VARCHAR(255) | | NULL | 頭像 |
| `password` | VARCHAR(255) | Not null | | 密碼 |
| `remember_token` | VARCHAR(100) | | NULL | |
| `created_at` | TIMESTAMP | | NULL | |
| `updated_at` | TIMESTAMP | | NULL | |
| `password_expired_at` | DATETIME | | NULL | 密碼過期時間 |
### Indices:
| Name | Columns | Type | Description |
| --- | --- | --- | --- |
| `PRIMARY` | `id` | PRIMARY | |
| `users_email_unique` | `email` | UNIQUE | |
| `users_email_verify_token_unique` | `email_verify_token` | UNIQUE | |