Hello everybody,
I work in a financial company as dev. I introduced my teammates to laravel a year or so and everybody is enjoying it ! I still struggle with a date format on SQL Server databases (really old version) as my company has decided different write and read formats. And as you mind guess, no way to change this behavior from de DB perspective... Your help would be appreciated :)
On tables, problematic columns are datetimes BUT :
- write action use a french format d/m/Y H:i:s (We do really good bread though...)
- read action use regular format Y/m/d H:i:s
I mostly adress this by creating a CustomBaseModel extending Eloquent/Model.
Then create any datetime related setters (I don't need to override getters as they work fine with the provided database column format).
Well, this works fine but it feels like I have a bad/weak approach (work fine for very small projects with few models). It also stop working as soon as we use third party libraries extending from the Base Eloquent Model.
I wonder if someone can brind new ideas to solve this issue. Of course I don't think modifying vendors library is a good practice (I'm pretty sure it's not;)) but how can I override base Eloquent model without making my onw...
Is it possible to change/add methods to the base eloquent/model from a service provider ? Composer way ?
Any help would be appreciated here
Thank you all !