I am currently doing my college thesis with Laravel 5.2, it is a Courses website similar to www.udacity.com.
I have the following models:
- Course
- Chapter
- Quiz
A course can have many chapters and a chapter may or may not have many quizzes. I have specified these relationships in each model.
I want to follow the same viewing order as Udacity has, where the user only has a "previous" and "next" button to cycle through the course. So, if I am viewing the course intro, the only available button is "next", that would take me to the first chapter in the course, at that moment I would have both buttons, the previous one would take me back to the course intro and the next one would take me to either the chapter's first quiz or to the next chapter if it does not have any quizzes.
Currently, I have an awful previous and next button logic full of if statements to determine if there is a next/previous chapter/quiz or not.
What would be the best practice form of achieving this?
Thanks for your help!