How to manage data and perform CRUD operations on a "models" that are stored in YAML files rather than in my database?
I'm building an LMS and want to add a feature where tutors can create quizzes and students can attempt those quizzes.
I want the quizzes to be stored as YAML files rather than in my database (I'm using MySQL). The main two reasons being so that they can be easily version controlled and faster to retrieve.
Stack: - Breeze scaffolding (Vue & Inertia SSR) - Filament admin panel
My question is, since I don't have a quizzes table, is there still some way I can make a Quiz model?
Because it seems to me that I would instead have to make a Quiz class that doesn't extend Model and parses a given YAML file. Surely there must be some packages out there that allow you to work with models and Eloquent for data stored in flat-files.
Another approach I could try is installing Statamic into my project but seems a bit overkill to have both Filament and Statamic on the same project for what is essentially a single Statamic collection (Quizzes).
A Quiz entry might look something like this: title: "Algebra Quiz" author: 3 level: "Intermediate" subject: 2 topics: - Algebra questions: - question: "What is the equation of the line that passes through the points (2, 3) and (-1, 5)?" choices: - "y = 2x + 7" - "y = -2x + 7" - "y = 2x - 7" - "y = -2x - 7" answer: "y = -2x + 7" - question: "What is the value of x in the equation 3x - 7 = 14?" choices: - "7" - "9" - "11" - "15" answer: "7" - question: "What is the solution set for the equation 2x + 5 = 9?" choices: - "{2}" - "{2.5}" - "{3}" - "{3.5}" answer: "{2}"
Regarding author and subject fields, I'm not sure whether to store these as IDs as I did above, or with some UUID such as email for author and slug for subject. submitted by /u/lewz3000
[link] [comments]
0 comments:
Post a Comment
Thanks