Support the ongoing development of Laravel.io →
Architecture
Last updated 2 years ago.
0

As an alternative approach I bind an observer(s) to my models and hook into the events. Not saying it is better, just another way to skin a cat.

Last updated 2 years ago.
0

It's a good way to separate things.

And about the fact of using an static class as a helper, what do you think?

Last updated 2 years ago.
0

I rarely using static methods. Whilst they maybe faster they are far less efficient in the eyes of the PHP garbage collector and prone to memory leeks when used unwisely (for example: inside a loop)

It would have no notable impact on your solution I just try to avoid static methods unless they are necessary. Such as the factory pattern.

Last updated 2 years ago.
0

jacksoncharles said:

I rarely using static methods. Whilst they maybe faster they are far less efficient in the eyes of the PHP garbage collector and prone to memory leeks when used unwisely (for example: inside a loop)

It would have no notable impact on your solution I just try to avoid static methods unless they are necessary. Such as the factory pattern.

I'l follow your advice.

Thanks jacksoncharles!

Last updated 2 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.

© 2024 Laravel.io - All rights reserved.