1 month ago

How To structure my app

Posted 1 month ago by Hugolino

Hello ,

I'm completely new to Laravel therefore i'm having a bad time knowing how to structure my code and where to put things . The idea of my app is simple ( kind of ) : I have two ressources , Reports and Shops . 1 shop can have multiple reports and 1 report only one shop => i've made a controller with all the crud methods for both + models and the routing works as it should . My issue is with the Reports : Each report is made by data from multiple sources , some will come from the database and some from a third party API ( i could get this data to the DB and fetch from there too ) .

Where do i put this logic ? where do i do the api calls and where do i need to get all the this data ( group the different returns ) together to return a complete report ?

i was thinking in doing a few methods in the reports controller one for fetching and one for grouping ..

But it doesn't seem right .

Can someone give me a bit of advice or point me to some material i could read/watch to learn a bit more ?

Cheers !

Please sign in or create an account to participate in this conversation.