blob: cf1a616041388bc2592313de649735f504fbb4bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
declare(strict_types=1);
namespace Engelsystem\Models;
use Engelsystem\Models\User\User;
use Engelsystem\Models\User\UsesUserModel;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
/**
* This class represents a message send trough the system.
*
* @property integer $id
* @property integer $receiver_id
* @property boolean $read
* @property string $text
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property-read User $receiver
* @method static Builder|Message whereId($value)
* @method static Builder|Message whereReceiverId($value)
* @method static Builder|Message whereRead($value)
* @method static Builder|Message whereText($value)
* @method static Builder|Message whereCreatedAt($value)
* @method static Builder|Message whereUpdatedAt($value)
*/
class Message extends BaseModel
{
use UsesUserModel;
/** @var bool enable timestamps */
public $timestamps = true;
/** @var string[] */
protected $casts = [
'user_id' => 'integer',
'receiver_id' => 'integer',
'read' => 'boolean',
];
/** @var string[] */
protected $fillable = [
'user_id',
'receiver_id',
'read',
'text',
];
/** @var array */
protected $attributes = [
'read' => false,
];
/**
* @return BelongsTo
*/
public function receiver(): BelongsTo
{
return $this->belongsTo(User::class, 'receiver_id');
}
}
|