Properly show time

protected function getCards(): array
{
$commercialHours = TimeRegistration::sum('time');
return [
// TimePicker::make('asasa'),
Card::make('Hours on commercial projects', $commercialHours)
->description('32k increase')
->descriptionIcon('heroicon-s-trending-up')
->color('success'),
];
}
protected function getCards(): array
{
$commercialHours = TimeRegistration::sum('time');
return [
// TimePicker::make('asasa'),
Card::make('Hours on commercial projects', $commercialHours)
->description('32k increase')
->descriptionIcon('heroicon-s-trending-up')
->color('success'),
];
}
'time' is a column in a table, and its of type, time(). When I call it, on the Card it shows as 120000, even though on the form, its specified like this:
Forms\Components\TimePicker::make('time')
->withoutDate()
->withoutSeconds()
->required(),
Forms\Components\TimePicker::make('time')
->withoutDate()
->withoutSeconds()
->required(),
So far my only solution has been to do $commercialHours = TimeRegistration::sum('time')/10000; Any better ideas?
1 Reply
Dennis Koch
Dennis Koch2y ago
Use a time cast on the column and Carbon format the value
Want results from more Discord servers?
Add your server