Use diff_in_days instead

This commit is contained in:
snipe
2025-10-03 15:03:14 +01:00
parent 013c50607a
commit 1cd9fc47aa
5 changed files with 14 additions and 5 deletions
+3 -2
View File
@@ -29,13 +29,14 @@ class SnipeModel extends Model
}
protected function expiresDiff(): Attribute
protected function expiresDiffInDays(): Attribute
{
return Attribute:: make(
get: fn(mixed $value, array $attributes) => $attributes['expiration_date'] ? round((Carbon::now()->diffInDays(Carbon::parse($attributes['expiration_date']), false, 1))) : null,
get: fn(mixed $value, array $attributes) => $attributes['expiration_date'] ? Carbon::parse($attributes['expiration_date'])->diffInDays() : null,
);
}
protected function expiresDiffForHumans(): Attribute
{
return Attribute:: make(