Passed
Push — master ( c57047...e9f946 )
by Mihail
06:06
created

CommentAnswer::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Apps\ActiveRecord;
4
5
use Ffcms\Core\Arch\ActiveModel;
6
7
/**
8
 * Class CommentAnswer. Active record model for comments answers list
9
 * @package Apps\ActiveRecord
10
 * @property int $id
11
 * @property int $comment_id
12
 * @property int $user_id
13
 * @property string $guest_name
14
 * @property string $message
15
 * @property string $lang
16
 * @property string $ip
17
 * @property boolean $moderate
18
 * @property string $created_at
19
 * @property string $updated_at
20
 * @property User $user
21
 * @property CommentPost $post
22
 */
23
class CommentAnswer extends ActiveModel
24
{
25
    protected $casts = [
26
        'id' => 'integer',
27
        'comment_id' => 'integer',
28
        'user_id' => 'integer',
29
        'guest_name' => 'string',
30
        'message' => 'string',
31
        'lang' => 'string',
32
        'ip' => 'string',
33
        'moderate' => 'boolean'
34
    ];
35
36
    /**
37
     * Get user relation object
38
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
39
     */
40
    public function user()
41
    {
42
        return $this->belongsTo(User::class, 'user_id');
43
    }
44
45
    /**
46
     * Get commentPost object relation
47
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
48
     */
49
    public function post()
50
    {
51
        return $this->belongsTo(CommentPost::class, 'comment_id');
52
    }
53
}
54