Skip to content

Commit 8cd12ef

Browse files
authored
fix: support CarbonImmutable for getCreatedAt() and getUpdatedAt() (#58) (#69)
* fix: support CarbonImmutable for getCreatedAt() and getUpdatedAt() (#58) * feat(locale): add Arabic translations for comments module
1 parent 3188956 commit 8cd12ef

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

resources/lang/ar/comments.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
return [
4+
'label' => 'التعليقات',
5+
'placeholder' => 'اكتب تعليقك…',
6+
'no_comments_yet' => 'لا توجد تعليقات .',
7+
8+
'user_avatar_alt' => 'صورة المستخدم ',
9+
10+
'commented_at' => 'علق في :datetime',
11+
'edited_at' => 'تم التعديل في :datetime',
12+
'edited' => 'تم التعديل',
13+
14+
'delete_comment_heading' => 'حذف التعليق',
15+
'delete_comment_body' => 'هل أنت متأكد من أنك تريد حذف هذا التعليق؟ .',
16+
17+
'cancel' => 'إلغاء',
18+
'delete' => 'حذف',
19+
'save' => 'حفظ',
20+
'comment' => 'تعليق',
21+
'add_reaction' => 'إضافة رد فعل',
22+
'show_more' => 'عرض المزيد',
23+
24+
'notifications' => 'الإشعارات',
25+
'unsubscribe' => 'إلغاء الاشتراك',
26+
'subscribe' => 'اشتراك',
27+
'subscribers' => 'المشتركون',
28+
'more' => 'أكثر',
29+
30+
'notification_subscribed' => 'تم الاشتراك في الإشعارات',
31+
'notification_unsubscribed' => 'تم إلغاء الاشتراك من الإشعارات',
32+
'notification_comment_deleted' => 'تم حذف التعليق',
33+
];

src/Comment.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Kirschbaum\Commentions;
44

55
use Carbon\Carbon;
6+
use Carbon\CarbonInterface;
67
use Closure;
78
use DateTime;
89
use Filament\Models\Contracts\HasAvatar;
@@ -149,12 +150,12 @@ public function getParsedBody(): string
149150
return $this->body_parsed;
150151
}
151152

152-
public function getCreatedAt(): DateTime|Carbon
153+
public function getCreatedAt(): DateTime|CarbonInterface
153154
{
154155
return $this->created_at;
155156
}
156157

157-
public function getUpdatedAt(): DateTime|Carbon
158+
public function getUpdatedAt(): DateTime|CarbonInterface
158159
{
159160
return $this->updated_at;
160161
}

src/Contracts/RenderableComment.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Kirschbaum\Commentions\Contracts;
44

5+
use Carbon\CarbonInterface;
6+
57
interface RenderableComment
68
{
79
public function isComment(): bool;
@@ -16,9 +18,9 @@ public function getBody(): string;
1618

1719
public function getParsedBody(): string;
1820

19-
public function getCreatedAt(): \DateTime|\Carbon\Carbon;
21+
public function getCreatedAt(): \DateTime|CarbonInterface;
2022

21-
public function getUpdatedAt(): \DateTime|\Carbon\Carbon;
23+
public function getUpdatedAt(): \DateTime|CarbonInterface;
2224

2325
public function getLabel(): ?string;
2426

src/RenderableComment.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Kirschbaum\Commentions;
44

55
use Carbon\Carbon;
6+
use Carbon\CarbonInterface;
67
use DateTime;
78
use Kirschbaum\Commentions\Contracts\RenderableComment as RenderableCommentContract;
89
use Livewire\Wireable;
@@ -23,9 +24,9 @@ class RenderableComment implements RenderableCommentContract, Wireable
2324

2425
protected ?string $label;
2526

26-
protected DateTime|Carbon $createdAt;
27+
protected DateTime|CarbonInterface $createdAt;
2728

28-
protected DateTime|Carbon $updatedAt;
29+
protected DateTime|CarbonInterface $updatedAt;
2930

3031
public function __construct(
3132
string|int $id,
@@ -79,12 +80,12 @@ public function getParsedBody(): string
7980
return $this->parsedBody ?? $this->body;
8081
}
8182

82-
public function getCreatedAt(): DateTime|Carbon
83+
public function getCreatedAt(): DateTime|CarbonInterface
8384
{
8485
return $this->createdAt;
8586
}
8687

87-
public function getUpdatedAt(): DateTime|Carbon
88+
public function getUpdatedAt(): DateTime|CarbonInterface
8889
{
8990
return $this->updatedAt;
9091
}

0 commit comments

Comments
 (0)