Total Complexity | 2 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | #[ObservedBy([BlogCommentObserver::class])] |
||
17 | class BlogComment extends Model |
||
18 | { |
||
19 | use BlogCommentPresenter; |
||
|
|||
20 | use FloodGate; |
||
21 | use HasCounts; |
||
22 | use HasMentionsTrait; |
||
23 | |||
24 | /** |
||
25 | * The attributes that are mass assignable. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $fillable = [ |
||
30 | 'blog_article_id', |
||
31 | 'content' |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * The accessors to append to the model's array form. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $appends = [ |
||
40 | 'content_markdown', |
||
41 | 'comment_url' |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * Get the user that owns the comment. |
||
46 | * |
||
47 | * @return BelongsTo |
||
48 | */ |
||
49 | #[CountedBy(as: 'blog_comment_count')] |
||
50 | public function user(): BelongsTo |
||
51 | { |
||
52 | return $this->belongsTo(User::class)->withTrashed(); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Get the article that owns the comment. |
||
57 | * |
||
58 | * @return BelongsTo |
||
59 | */ |
||
60 | #[CountedBy(as: 'blog_comment_count')] |
||
64 | } |
||
65 | } |
||
66 |