Support the ongoing development of Laravel.io →
posted 11 years ago
Architecture

Hi !

I'm trying to improve my webiste architecture and read a lot about Repo and Presenters. Right now my models use a lot of accessors to prepare some data, and I saw that it's not such a good practice to let my models do all this jobs and that a better place would be a view presenter. Ok why not. But after more digging I see other using repositories to abstract the model layer and they do this kind of jobs in the repo and not in a view presenter... when should I do what ?

Also while trying to tidy up my structure I found myself having a difficult choise. In my "app/myproject" should I have my folder by "modules", like one for my images manipulation interface called "Images", one for my users repo called "Users" etc... or having my folder by "types", like "Repo", "Interfaces", "Service", "Presenters"....

Thanks for your tips !

Last updated 3 years ago.
0

I'm doing it like this (I don't know it is the right way)

app / trinity(app name) / Users / User, UserPresenter, UserRepository 
Last updated 3 years ago.
0

So your UserPresenter work on the Repo or is it called by the Controller ?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.