I'm currently in the making of a quiz system using laravel.
I've done most the work allready however i cant seem to figure out how i get laravel to display only one question pr page? - I know how to show them all through a foreach loop and i have bound them all through relationships.
I have one question which has up to 4 postulates which you can answer yes or no to.
Its meant that when you click the next question button it will save your inputs in case you loose internet connection or just want to continue later on.
Would anyone know how to achieve this?
You dont have to write bunch of code i just need to be pointed in the right direction.
Since you want the offline compatibility I suggest you make it in Javascript and a backend API. You could take a look at the VueJS lessons on this website.
In this way you save the current question and when they answer your API respond with the next question. You can reference the questions with UID (Unique Identifier) if you don't want anyone to be able to guess the number of the next question.
But before it makes sense to explain in detail you should know about Javascript and AJAX. I recommend VueJS and Vue-Resource, but that's completely up to you if you prefer something else instead.
You can do it without Javascript, but I think in the long run you will be happy to benefit from it here.
My recommendation to you is to watch the entire serie about Vue (the 1.xx one, not the one from before version 1). Then you can decide if it feels right for you after. It's a day or half you have to invest, but might pay off.
For me was jQuery always a mess after a while and Angular seem bloated with unnecessary stuff, where I found Vue to be a more simple approach that is closer to how I work in PHP.
To get the question: GET yourapp/question/_id_
To answer the question: POST yourapp/question/_id_
Maybe to get the next question: GET yourapp/question/_id_/next
Hope it makes sense and that I'm not putting too much work on you. My Youtube isn't working for some reason, but there are some explanations https://www.youtube.com/watch?v=7YcW25PHnAA
But again, it's not rocket science just an URL that responds some data.
I do however need a way so that when you click on next it saves the answers to the database as you go through the questions. So if you loose internet in the middle of a question its only that one and the ones ahead that you "havent" answered.
So all the allready answered will stay answered ;)