small fixes

This commit is contained in:
F4ilji
2025-06-14 19:33:49 +05:00
parent c906314111
commit 501e5487b9
3 changed files with 14 additions and 6 deletions
@@ -26,7 +26,13 @@ class PostItemResource extends JsonResource
'authors' => $this->authors,
'gallery' => $this->images,
'reading_time' => $this->reading_time,
'created_post' => Carbon::parse($this->publish_at)->diffforhumans(),
'created_post' => Carbon::parse($this->publish_at)
->locale('ru')
->translatedFormat(
Carbon::parse($this->publish_at)->isCurrentYear()
? 'd M'
: 'd M Y' . ' г.'
)
];
}
}
@@ -25,7 +25,13 @@ class PostListResource extends JsonResource
'authors' => $this->authors,
'preview' => $this->preview,
'reading_time' => $this->reading_time,
'created_post' => Carbon::parse($this->publish_at)->diffforhumans(),
'created_post' => Carbon::parse($this->publish_at)
->locale('ru')
->translatedFormat(
Carbon::parse($this->publish_at)->isCurrentYear()
? 'd M'
: 'd M Y'
)
];
}
}