1 | <?php |
||
26 | class Participation extends Model implements ParticipantContract |
||
27 | { |
||
28 | /* ----------------------------------------------------------------- |
||
29 | | Properties |
||
30 | | ----------------------------------------------------------------- |
||
31 | */ |
||
32 | |||
33 | /** |
||
34 | * The attributes that can be set with Mass Assignment. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $fillable = [ |
||
39 | 'discussion_id', |
||
40 | 'participable_type', |
||
41 | 'participable_id', |
||
42 | 'last_read', |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * The attributes that should be mutated to dates. |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $dates = ['last_read', 'deleted_at']; |
||
51 | |||
52 | /** |
||
53 | * The attributes that should be cast to native types. |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $casts = [ |
||
58 | 'id' => 'integer', |
||
59 | 'discussion_id' => 'integer', |
||
60 | 'participable_id' => 'integer', |
||
61 | ]; |
||
62 | |||
63 | /* ----------------------------------------------------------------- |
||
64 | | Constructor |
||
65 | | ----------------------------------------------------------------- |
||
66 | */ |
||
67 | |||
68 | /** |
||
69 | * Create a new Eloquent model instance. |
||
70 | * |
||
71 | * @param array $attributes |
||
72 | */ |
||
73 | 186 | public function __construct(array $attributes = []) |
|
81 | |||
82 | /* ----------------------------------------------------------------- |
||
83 | | Relationships |
||
84 | | ----------------------------------------------------------------- |
||
85 | */ |
||
86 | |||
87 | /** |
||
88 | * Discussion relationship. |
||
89 | * |
||
90 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
91 | */ |
||
92 | 6 | public function discussion() |
|
98 | |||
99 | /** |
||
100 | * Participable relationship. |
||
101 | * |
||
102 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
103 | */ |
||
104 | 54 | public function participable() |
|
108 | |||
109 | /* ----------------------------------------------------------------- |
||
110 | | Getters & Setters |
||
111 | | ----------------------------------------------------------------- |
||
112 | */ |
||
113 | |||
114 | /** |
||
115 | * Get the participable string info. |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 6 | public function stringInfo() |
|
123 | } |
||
124 |