gocevskam's avatar

How to build a questionnaire application with laravel 5.1?

Hello I am trying to build a questionnaire application with laravel 5.1.

As for the moment I have 3 questionnaires, but there will surely be more in future. I would want the admin to be able to add questionnaires, but it is not a concern at the moment. (I have the admin and other users roles and I would want to make the questionnaires available for the users).

As for now I just have the questions in a form to be filled in by the user and it is saved in the database(meaning I have a separate table for each questionnaire). Each answer is a choice (radio buttons), which have a different value and I calculate the result with jQuery and save it to the same table.

I know it is not a good approach, but I couldn't think of how to do it otherwise.

Can you please help me with it?

0 likes
1 reply
sid405's avatar

@gocevskam A separate table for each questionnaire? Why?

Use a table for the questionnaires. All questionnaires. One for the choices available referencing the questionnaire_id. And one for the choices made, referencing the choice_id (which is unique now to a given questionnaire, since the choice itself has a questionnaire_id).

Id you're having logged in users fill the survey, then reference the user_id on the table where you store the choices made.

This should be able to help you http://www.databaseanswers.org/data_models/student_questionnaires/index.htm

best, sid

1 like

Please or to participate in this conversation.