6
6
7
7
use App \Contracts \ReactableInterface ;
8
8
use App \Contracts \ReplyInterface ;
9
+ use App \Contracts \SpamReportableContract ;
9
10
use App \Traits \HasAuthor ;
10
11
use App \Traits \HasReplies ;
12
+ use App \Traits \HasSpamReports ;
11
13
use App \Traits \Reactable ;
12
14
use App \Traits \RecordsActivity ;
13
15
use Carbon \Carbon ;
17
19
use Illuminate \Database \Eloquent \Relations \HasOne ;
18
20
use Illuminate \Database \Eloquent \Relations \MorphMany ;
19
21
use Illuminate \Database \Eloquent \Relations \MorphTo ;
22
+ use Illuminate \Support \Collection ;
20
23
use Illuminate \Support \Str ;
21
24
22
25
/**
28
31
* @property User $user
29
32
* @property int $replyable_id
30
33
* @property string $replyable_type
34
+ * @property Collection | SpamReport[] $spamReports
31
35
*/
32
- final class Reply extends Model implements ReactableInterface, ReplyInterface
36
+ final class Reply extends Model implements ReactableInterface, ReplyInterface, SpamReportableContract
33
37
{
34
38
use HasAuthor;
35
39
use HasFactory;
36
40
use HasReplies;
41
+ use HasSpamReports;
37
42
use Reactable;
38
43
use RecordsActivity;
39
44
@@ -56,11 +61,6 @@ public function getPathUrl(): string
56
61
return "#reply- {$ this ->id }" ;
57
62
}
58
63
59
- public function solutionTo (): HasOne
60
- {
61
- return $ this ->hasOne (Thread::class, 'solution_reply_id ' );
62
- }
63
-
64
64
public function wasJustPublished (): bool
65
65
{
66
66
return $ this ->created_at ->gt (Carbon::now ()->subMinute ());
@@ -83,6 +83,11 @@ public function to(ReplyInterface $replyable): void
83
83
$ this ->replyAble ()->associate ($ replyable ); // @phpstan-ignore-line
84
84
}
85
85
86
+ public function solutionTo (): HasOne
87
+ {
88
+ return $ this ->hasOne (Thread::class, 'solution_reply_id ' );
89
+ }
90
+
86
91
public function allChildReplies (): MorphMany
87
92
{
88
93
return $ this ->replies ()
0 commit comments