Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vesst's avatar
Level 2

Laravel Nova Questions based on database & type of role.

I have 2 types of users who need a form with questions about those users - kinda like a "General Information / Profile Information" about the user. I have 30 questions with some conditional logic. But unsure if I am going down the right path.

Right now I have the questions in the database and seeded. But now that I got that far I am uncertain on the best way to pull those questions into a Nova Component or Form. There will only be 1 questionnaire to 1 to a user.

Here is the example questions:

'id' => 1,
'information_id'  => 1,
'question_type'  => 'textarea',
'question_order' => 1,
'question_group' => 'General Information',
'question_text'  => 'Describe your experience in providing services to individuals with developmental disabilities.',
'option_json'    => '{}',
'status'         => 'active',
'created_at'     => '2019-11-11 12:28:08',
'updated_at'     => '2019-11-11 12:28:08',

Best practice to accomplish this?

0 likes
5 replies
bugsysha's avatar

Not sure what you are trying to achieve. Can you describe the flow? From a glance it looks like you've overcomplicated it, but like I said, let us know what the flow is and what is the difference between user types for interaction with these questions.

vesst's avatar
Level 2

Yeah I am thinking I am overthinking it.

There are 2 roles. Individual and Agency

For their Profile Information they will be given 2 different types of question/answers. Agencies get 25 questions, and Individuals get 8.

I wanted to push all the question answers into json, rather than having a database with all the question/answers.

My question really is should i pull the questions from the database or just create a Nova form and push all that data to a database.

It just seems like this is going to get complicated road ahead but I am not sure if there is a best practice for this in Nova. (this is my first project using Nova.)

bugsysha's avatar
bugsysha
Best Answer
Level 61

I would go with the database since it is easier later on to see who answered what. Also do not store answers in JSON but on separate table so you can have many to many relationship between answers and roles/users.

vesst's avatar
Level 2

Thanks Bugsysha it will be easier. Thanks for that feedback.

bugsysha's avatar

You are very welcome. If you are happy with the answer then please mark it as best answer. Thanks.

Please or to participate in this conversation.