1 | <?php |
||
10 | class DiscussPost extends Model |
||
11 | { |
||
12 | use Countable, |
||
13 | DiscussPostPresenter, |
||
14 | FloodGate, |
||
15 | HasMentionsTrait; |
||
16 | |||
17 | /** |
||
18 | * The attributes that are mass assignable. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $fillable = [ |
||
23 | 'user_id', |
||
24 | 'conversation_id', |
||
25 | 'content', |
||
26 | 'is_edited' |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * The accessors to append to the model's array form. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $appends = [ |
||
35 | 'content_markdown', |
||
36 | 'post_url' |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * The attributes that should be mutated to dates. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $dates = [ |
||
45 | 'edited_at' |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * The "booting" method of the model. |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | protected static function boot() |
||
62 | |||
63 | /** |
||
64 | * Return the count cache configuration. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function countCaches(): array |
||
75 | |||
76 | /** |
||
77 | * Get the user that owns the post. |
||
78 | * |
||
79 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
80 | */ |
||
81 | public function user() |
||
85 | |||
86 | /** |
||
87 | * Get the conversation that owns the post. |
||
88 | * |
||
89 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
90 | */ |
||
91 | public function conversation() |
||
95 | |||
96 | /** |
||
97 | * Get the user that edited the post. |
||
98 | * |
||
99 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
100 | */ |
||
101 | public function editedUser() |
||
105 | } |
||
106 |