Closed eloypr closed 10 years ago
Sorry I have not worked with carbon, if you know what the issue is feel free to create a pull request and I'll look at it
@eloypr its not that datatables is not working with carbon, its more that datatables is not working with the custom getters of the model ( just getting the data from the db ) you could solve it by doing this:
{{ User::find($id)->created_at->format(etc..) }}
this way you get the item from the model using lazy loading.
cheers
This is what I do: ->edit_column('updated_at', '{{{ Carbon::parse($updated_at)->diffForHumans() }}}')
@gcphost my point is more that if you can give a Eloquent reference to DataTables, you should be able to use the custom getters / setters from this model instead of creating some sort of sql query and using that.
in other words if i add an function getFooAttribute(){ return 'bar'; } id expect when selecting User::select('id','user', 'bar') that the bar getter is invoked
thanks for your reply though, but this a hack, not a solution :)
This package currently does not work with Eloquent relations, custom getters and setters etc. Eloquent models are handled as if they were Query Builder objects. This may change in future versions but for now it's not possible to use ORM functionality.
Datetime Carbon doesn't work:
But it works:
Can update for compatiblility with Carbon?