8 months ago

Generate pages dynamically

Posted 8 months ago by sjking85

Hello, I'm learning Laravel and hope someone can help me.

I am trying to replicate a number of paper forms which I have to my web app with each one subsequently having data on various sections of the individual form which will explain what needs to be filled in and why.

At the moment, I have a table in my database named forms and has columns for id, form_number, form_description and the appropriate timestamps.

On my forms.index I am successfully looping through the data and displaying the results as expected.

However, my issue is as follows:

Each form is completely different in appearance. For example, form 7 looks completely different to form 18. I'd like for a user to click "View" and then they are presented with an HTML version of the form which I'll style up with Bootstrap to replicate the physical form.

By clicking "View" I could display the data through the show method and send the user to the appropriate show.blade.php through the controller, but this obviously leaves me with a very rigid page to work with.

I've considered using just the show.blade.php and somehow switching the form_number to display HTML based on its value but naturally, this will mean all of the content is coded on to one page.

Do you good folks have any suggestions?

Please sign in or create an account to participate in this conversation.