Total Complexity | 2 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | #[ObservedBy([CommentObserver::class])] |
||
17 | class Comment extends Model |
||
18 | { |
||
19 | use CommentPresenter; |
||
|
|||
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 | 'article_id', |
||
31 | 'user_id', |
||
32 | 'content' |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * The accessors to append to the model's array form. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $appends = [ |
||
41 | 'content_markdown', |
||
42 | 'comment_url' |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * Get the user that owns the comment. |
||
47 | * |
||
48 | * @return BelongsTo |
||
49 | */ |
||
50 | #[CountedBy] |
||
51 | public function user(): BelongsTo |
||
52 | { |
||
53 | return $this->belongsTo(User::class); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Get the article that owns the comment. |
||
58 | * |
||
59 | * @return BelongsTo |
||
60 | */ |
||
61 | #[CountedBy] |
||
65 | } |
||
66 | } |
||
67 |