realdigi's avatar

Project Organization

i have been learning laravel and truly its quite fun. but so far the projects i have been doing are just small applications with very few controller files and model. Not much to "Organize" per se. But my question is,

1# how to organize files when a project gets larger and larger?

2#is there any recommended project structure that i could follow from the start of any project so that even if in future the project grows bigger, things are modular and easy to manage with?

thanks.

0 likes
2 replies
ankitparmar372's avatar
Level 6

Hi Realdigi, i hope you doing well

I used to write my business logic in repositories

controller only to get the request and response

models used for relations

Validation in Requests folder - also you can use persist method to interact with the data. (php artisan make:Request AnyRequest)

2 likes
realdigi's avatar

hey! thanks for the insight. could you please explain it in a bit detail because i am kind of a noob and bad with new words. here are some points i didnt quite get-

  1. my understanding is that business logic is the code to be run before doing any views. and i have been doing them in controllers. but you mentioned about doing it in "repositories". could you please elaborate it more.

  2. isnt the route file supposed to deal with http request and response? but how do you do them in controllers. i do have a feeling though that i am mixing up terminologies.

  3. about the models i get the idea.

  4. "Validation in Requests folder - also you can use persist method to interact with the data. (php artisan make:Request AnyRequest)"

    • i get it, but still an elaboration would be helpful.

thanks.

Please or to participate in this conversation.