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.
45 lines
2.7 KiB
Markdown
45 lines
2.7 KiB
Markdown
2 weeks ago
|
# Evaluation and Rate Models
|
||
|
|
||
|
The `Evaluation` and `Rate` models are designed to enable users to provide assessments and scores for different models or entities in the system. These models work together to facilitate a comprehensive feedback mechanism, making it easy for organizations to gather and analyze user evaluations and ratings.
|
||
|
|
||
|
## Evaluation Model
|
||
|
|
||
|
The `Evaluation` model is used to create and manage evaluations that can be associated with various entities in the system. This model allows different types of content (like products, services, or experiences) to be evaluated according to a specific title.
|
||
|
|
||
|
### Fields
|
||
|
|
||
|
- **id**:
|
||
|
- A unique identifier for each evaluation. This number is automatically generated by the system to differentiate each evaluation entry.
|
||
|
|
||
|
- **title**:
|
||
|
- The name or title of the evaluation. This field provides a clear description of what the evaluation is about, helping users understand the focus of their assessment.
|
||
|
|
||
|
- **nullableMorphs('evaluationable')**:
|
||
|
- This field allows the evaluation to be associated with different types of models (e.g., a product or a service). The term "morphs" means that this model can reference several different entities, providing flexibility in what can be evaluated.
|
||
|
|
||
|
---
|
||
|
|
||
|
## Rate Model
|
||
|
|
||
|
The `Rate` model is specifically designed to store ratings provided by users or customers based on the evaluations created. It captures the scoring and allows the evaluator to be identified, whether they are a registered user or a guest customer.
|
||
|
|
||
|
### Fields
|
||
|
|
||
|
- **id**:
|
||
|
- A unique identifier for each rating. Like evaluations, this number is automatically generated by the system to easily track and manage each rate entry.
|
||
|
|
||
|
- **morphs('rateable')**:
|
||
|
- This field connects the rating to a specific evaluation. It indicates which evaluation the user is rating, allowing for multiple ratings against various evaluations.
|
||
|
|
||
|
- **morphs('rater')**:
|
||
|
- This field designates who provided the rating. It can reference either a registered user or a customer, giving insight into who is providing feedback.
|
||
|
|
||
|
- **rate**:
|
||
|
- A tiny integer that indicates the score given by the rater. This score usually reflects the quality or satisfaction level associated with the evaluation, with predefined ranges (e.g., 1 to 5 stars).
|
||
|
|
||
|
- **evaluation_id**:
|
||
|
- The unique identifier of the evaluation being rated. This field establishes a foreign key relationship, linking the rate to a specific evaluation record, thus ensuring that every rating can be traced back to its corresponding evaluation.
|
||
|
|
||
|
---
|
||
|
|
||
|
This structure explains the `Evaluation` and `Rate` models in a clear and simple manner, making it easy for anyone to understand their purpose and functionality without needing a technical background.
|