Open olavski opened 5 years ago
You solution gives me a Fatal Error. You trait and the Eloquent Model both have the property dateFormat defined.
Ok, I'll have another look at it.
I think you can just remove the dateFormat property and it should work aswell
Hi,
I see there is a pull request related to date format, so I thought I'd just show how I handle datetime with Eloquent.
Currently when saving dates (INSERT/UPDATE) CrateDB accepts 'Y-m-dTH:i:s' format, but when querying (SELECT) it returns a millisecond timestamp.
I've created a Eloquent model trait that makes CrateDB models handle DateTime fields same way as with MySQL: https://github.com/web64/laravel-cratedb-demo/blob/master/app/Models/Traits/HasCrateDates.php
Then you can use Carbon dates:
As this is a optional trait that can be added to models, there is full backward compatability and no changes needed in the core laravel-crate.io library.
Please note this is a work-in-progress and not fully tested.
Cheers, Olav