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

Randy_Johnson's avatar

Food for thought

Is a controller or model needed. Could MVC just be MV, or VC, or am I just a crazy person.

Also I always written all my store stuff in controller store, is the correct way to write a store function in the model and then pass request parameters from the validation into

E.g. User->store($validated)

Apologies if it's wrong syntax, but due to AI I haven't written a line of code in months 😳

Edit: also validation has it's own area now which I never use, I just write it at the head of the store function, but wouldn't this be better to just be a function in the model that is called. Or am I just a crazy person 🤪

0 likes
3 replies
jlrdw's avatar

VC is fine in some cases. If using query builder instead of eloquent for example.

In java many time I'd use VC, meaning servlet and view.

But usually in a larger app it's best to go full MVC. I know in laravel a lot of people do as you do and store in the controller. I as well, but for queries to retrieve data I use full MVC. I make use of query scopes also when needed.

I try to keep the controller lean. I'd rather have a fatter model.

Snapey's avatar

Conventions like MVC exist because they are the most practical approach for most projects.

Of course this can be overly structured for very simple sites, and not structured enough for much larger projects.

Yes, you could write data straight from the request to the model, this might work for simple forms, but what when the request involves MULTIPLE models? What if you need to run business logic on the data; where would you put that?

You can write php any way you like, but if you write a decent amount you will wish you had been more careful about the way it was built in the first place.

Please or to participate in this conversation.