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

okorpheus's avatar

Learning Laravel and MVC, need help wrapping my head around the architecture

I've got a site that manages competitive events. Over the years, it has grown to a pile of nearly unmanageable spaghetti and I'm considering rewriting it using laravel, but have some aspects of the MVC architecture I can't quite wrap my head around.

Part of the system involves judges entering a number of subscores for each entry. A final score is arrived at by dropping the highest and lowest score, then there's a system involving the subscores used for tiebreakers.

I can see there are 3 models in this scenario - judges, entries, and scores. The judges and entries are obvious, the scores model will have a relationship to one entry and one judge then columns for each subscore. What I'm not clear on is where does the logic to combine the individual scores for each entry into a final score. Would that code be part or the entry model? The controller? Some kind of total score model that combines the individual judges scores for an entry?

0 likes
3 replies
Snapey's avatar

you can either calculate the scores as you go or just when viewing a result, but it seems to me you are missing a result table?

entry has many scores / score belongs to entry

judge has many scores / score belongs to judge

result belongs to entry / entry has one result

result for entry can be updated each time a score for entry is recorded

Bogey's avatar

I think you are talking about relations in eloquent between different tables and how to code them. This stuff is usually very simple in laravel and many resources here on laracasts and on youtube explaining how to work with these things.

I suggest you start with laravel from scratch laracast course as was suggested earlier and maybe watch some youtube tutorials on how to make a blog or something to give yourself the push you need to start. Don't give up though, I'm on my journey learning laravel and I'm enjoying it.

Keep in mind laravel system is strong on conventions, particularly how you name your models, views and controllers (maybe not so much about views, but you'll get into a habit).

Please or to participate in this conversation.