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'
)
];
}
}
@@ -26,10 +26,6 @@ class HandleInertiaRequests extends Middleware
'auth' => [
'user' => $request->user() ? $request->user()->only('id', 'name', 'email', 'created_at') : null,
],
// 'ziggy' => fn () => [
// ...(new Ziggy)->toArray(),
// 'location' => $request->url(),
// ],
'ziggy' => function() {
return array_merge((new Ziggy())->toArray(), [
'location' => url()->current(),