mirror of https://github.com/4xmen/xshop.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
3.8 KiB
Markdown
66 lines
3.8 KiB
Markdown
2 weeks ago
|
# Settings Model
|
||
|
|
||
|
The `Settings` model is designed to manage various configurations for the system. It allows administrators to set and customize system behaviors and functionalities in a structured way. Each setting can be categorized and stored with specific attributes to facilitate easy management.
|
||
|
|
||
|
## Fields
|
||
|
|
||
|
- **id**:
|
||
|
- A unique identifier for each setting entry. This number is automatically generated by the system to ensure that every setting can be distinguished from one another.
|
||
|
|
||
|
- **section**:
|
||
|
- This field categorizes settings into specific groups. Common values include `general`, `seo`, `sms`, `theme`, or any custom value defined by the user. This categorization helps simplify the management of settings.
|
||
|
|
||
|
- **type**:
|
||
|
- Defines the data type for the setting value. It could be one of the following options:
|
||
|
- **TEXT**: Standard text input.
|
||
|
- **NUMBER**: Numeric input.
|
||
|
- **LONGTEXT**: For handling large amounts of text.
|
||
|
- **CODE**: Suitable for programming code snippets.
|
||
|
- **EDITOR**: A rich text editor for formatted text.
|
||
|
- **CATEGORY**: For selecting specific categories.
|
||
|
- **GROUP**: For grouping related settings.
|
||
|
- **CHECKBOX**: A boolean option that can be either checked or unchecked.
|
||
|
- **FILE**: For uploading files.
|
||
|
- **COLOR**: For color selection.
|
||
|
- **SELECT**: A dropdown menu for selecting one option.
|
||
|
- **MENU**: For managing navigation menus.
|
||
|
- **LOCATION**: For selecting geographic locations.
|
||
|
- **ICON**: For selecting icons.
|
||
|
- **DATE**: A date input.
|
||
|
- **DATETIME**: A date and time input.
|
||
|
- **TIME**: A time input.
|
||
|
|
||
|
- **title**:
|
||
|
- A descriptive title for the setting. This title will be displayed in the admin interface, providing clarity on what the setting controls.
|
||
|
|
||
|
- **active**:
|
||
|
- A boolean field indicating whether this setting is currently active. By default, it is set to `true`, meaning the setting is enabled.
|
||
|
|
||
|
- **key**:
|
||
|
- A unique identifier for the setting. This key must be unique and is used to retrieve or modify the setting in the system.
|
||
|
|
||
|
- **value**:
|
||
|
- This field allows for the storage of the setting's value. It can accommodate translation if needed, meaning the same setting could have different values for different languages.
|
||
|
|
||
|
- **raw**:
|
||
|
- A text field that stores the original value of the setting without any translations. This allows administrators to easily reference the underlying data.
|
||
|
|
||
|
- **ltr**:
|
||
|
- A boolean field that indicates if the layout should be left-to-right. By default, it is set to `false`.
|
||
|
|
||
|
- **is_basic**:
|
||
|
- A boolean field indicating whether this setting is a core requirement for the system. It is set to `false` by default, but essential settings should be marked as true.
|
||
|
|
||
|
- **size**:
|
||
|
- This field specifies a value from 1 to 12 to determine the width of the input field in Bootstrap layout. The default value is set to `12`, which is full-width.
|
||
|
|
||
|
- **data**:
|
||
|
- A JSON field that can store additional information related to the setting. For example, if the type is `NUMBER`, the `data` field could specify the minimum and maximum values allowed. This flexibility allows for enhanced validation and configurability.
|
||
|
|
||
|
## Dynamic Field Generation
|
||
|
|
||
|
When displaying settings in the system, the appropriate input fields are dynamically generated based on the type of each setting. This automation simplifies the user's experience, enabling them to easily manage settings without needing technical knowledge. You can add your own setting if you wish. When you change design of theme setting will be updated.
|
||
|
|
||
|
---
|
||
|
|
||
|
This structure outlines the `Settings` model, emphasizing how it can be used to manage configurations effectively and simplify the administrative tasks associated with system settings. The document is designed to be user-friendly for non-technical users, ensuring clarity and ease of understanding.
|