Laravel Challenge: Many-to-Many Relationships - Olympics

This is a form to save the medal winners in the olympics, by sport. The result of the form submission, should be a redirect to the medals table, ordered by best countries: most gold medals, then if equal - ordered by most silver medals, if still equal - by bronze medals.

So the form is created for you, the challenge is to actually save the form data and calculate/show the result table.

Form

Result table

The task details:

  • You need to fill in two methods in SportsController and fill in the data in show.blade.php file;
  • You also need to create the correct many-to-many relationship to save that data, potentially with additional fields in the pivot table.
  • Bonus points: you may create the front-end and/or back-end validation, so that you couldn't select the same country for 1st/2nd/3rd place. Use whichever framework you prefer - Vue, Livewire, jQuery, etc.

Rules: How to perform the task

I will be expecting a Pull Request to the main branch, containing all code for completely working project.

If you don't know how to contribute a PR, here's my video with instructions.

Important: I will NOT merge the Pull Request, only comment on it, whether it's correct or not.

With my limited time, I will probably personally review random 10-20 Pull Requests, all the others will still get "karma points" for doing a good job and improving their skills.

If you have any questions, or suggestions for the future challenges, please open an Issue.

Good luck!