1 | <?php namespace Arcanedev\LaravelMessenger\Models; |
||
23 | class Participant extends Model implements ParticipantContract |
||
24 | { |
||
25 | /* ------------------------------------------------------------------------------------------------ |
||
26 | | Traits |
||
27 | | ------------------------------------------------------------------------------------------------ |
||
28 | */ |
||
29 | use SoftDeletes; |
||
30 | |||
31 | /* ------------------------------------------------------------------------------------------------ |
||
32 | | Properties |
||
33 | | ------------------------------------------------------------------------------------------------ |
||
34 | */ |
||
35 | /** |
||
36 | * The attributes that can be set with Mass Assignment. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $fillable = ['discussion_id', 'user_id', 'last_read']; |
||
41 | |||
42 | /** |
||
43 | * The attributes that should be mutated to dates. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $dates = ['last_read', 'deleted_at']; |
||
48 | |||
49 | /** |
||
50 | * The attributes that should be cast to native types. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $casts = [ |
||
55 | 'discussion_id' => 'integer', |
||
56 | 'user_id' => 'integer', |
||
57 | ]; |
||
58 | |||
59 | /* ------------------------------------------------------------------------------------------------ |
||
60 | | Constructor |
||
61 | | ------------------------------------------------------------------------------------------------ |
||
62 | */ |
||
63 | /** |
||
64 | * Create a new Eloquent model instance. |
||
65 | * |
||
66 | * @param array $attributes |
||
67 | */ |
||
68 | public function __construct(array $attributes = []) |
||
76 | |||
77 | /* ------------------------------------------------------------------------------------------------ |
||
78 | | Relationships |
||
79 | | ------------------------------------------------------------------------------------------------ |
||
80 | */ |
||
81 | /** |
||
82 | * Discussion relationship. |
||
83 | * |
||
84 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
85 | */ |
||
86 | public function discussion() |
||
92 | |||
93 | /** |
||
94 | * User relationship. |
||
95 | * |
||
96 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
97 | */ |
||
98 | public function user() |
||
104 | |||
105 | /* ------------------------------------------------------------------------------------------------ |
||
106 | | Getters & Setters |
||
107 | | ------------------------------------------------------------------------------------------------ |
||
108 | */ |
||
109 | /** |
||
110 | * Get the participant string info. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | public function stringInfo() |
||
118 | } |
||
119 |