kdion4891 / laravel-livewire-tables

A dynamic, responsive Laravel Livewire table component with searching, sorting, checkboxes, and pagination.
302 stars 41 forks source link

[Question] Date casting (and other castings) #16

Closed booni3 closed 4 years ago

booni3 commented 4 years ago

I noticed between Laravel 6 and Laravel 7 the way which date castings are handled in this package. On L6 we got a pretty date format, while on L7 we get something like 2020-03-14T00:16:13.000000Z.

I assume this is the way in which Laravel is handling the casting.

Question: is it possible to manipulate the data being outputted to the table without creating a new view file. i.e. something inline?

kdion4891 commented 4 years ago

Yeah there are details on how to revert back to the 6 functionality in the 7 upgrade docs:

https://laravel.com/docs/7.x/upgrade#date-serialization

You can also use model accessors:

https://laravel.com/docs/7.x/eloquent-mutators#defining-an-accessor

Or, you can use a custom view file for your table column:

https://github.com/kdion4891/laravel-livewire-tables#viewview