samedi 8 juin 2019

Where is the correct place to locate custom functions in Laravel?

In my projects I usually create several functions, which some of them are debug functions (I use microtimes, var_dumps, print_r, ...) to customize the data, and others are functions that end up being used very often in the project (for example functions that do certain things with session variables, that works with an object / array and return it in a certain way, etc.).

I always have doubts about where I should include these functions. So far the second type of functions (work with session variables, general scope functions that alter project variables) put them in a controller (CommonController), while the first type of functions (debug functions in the vast majority) I thought to put in a helper.

However, I still have serious doubts about whether both groups of functions should be placed on those sites.

Please, someone who can guide me a little?

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire