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

WallAnswer::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 WallAnswer. Active record model for wall answers for wall posts
9
 * @package Apps\ActiveRecord
10
 * @property int $id
11
 * @property int $post_id
12
 * @property int $user_id
13
 * @property string $message
14
 * @property string $created_at
15
 * @property string $updated_at
16
 * @property User $user
17
 * @property WallPost $post
18
 */
19
class WallAnswer extends ActiveModel
20
{
21
    protected $casts = [
22
        'id' => 'integer',
23
        'post_id' => 'integer',
24
        'user_id' => 'integer',
25
        'message' => 'string'
26
    ];
27
28
    /**
29
     * Get user object relation
30
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
31
     */
32
    public function user()
33
    {
34
        return $this->belongsTo(User::class, 'user_id');
35
    }
36
37
    /**
38
     * Get wall post object relation
39
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
40
     */
41
    public function post()
42
    {
43
        return $this->belongsTo(WallPost::class, 'post_id');
44
    }
45
}
46