Open fergusweb opened 4 years ago
I ran into the same problem and I'm noting this fix if others come across it. Thanks for explaining the issue so well it saved me time. I changed the "public function formatDates($dates)" return line to this below to include the label:
return DateColumn::name($column->name)->format($format)->label($column->label);
If I include the
dates
attribute, then the custom labels provided ininclude
disappear. In below example, two columns should say "Domain Expires" and "Hosting Expires". In practice, they both say "Expires". However I remove thedates
attribute, the labels will be correct. Important to note that the non-date label works in both cases, so this only seems to affect date columns.This can be seen in your Intermediate example here too: https://livewire-datatables.com/intermediate You include column
created_at|Created
, and yet it appears in the table labelled as "Created At".It seems to default to the mysql column name for date fields, but I'm just getting started with Laravel and couldn't figure out a fix.