Passed
Push — master ( 3a195a...0456bd )
by Mihail
06:35
created

FeedbackAnswer::getFeedbackPost()   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
use Ffcms\Core\Traits\SearchableTrait;
7
use Illuminate\Support\Collection;
8
9
/**
10
 * Class FeedbackAnswer. Answers relation to feedback request posts.
11
 * @package Apps\ActiveRecord
12
 * @property int $id
13
 * @property int $feedback_id
14
 * @property string $name
15
 * @property string $email
16
 * @property string $message
17
 * @property bool $is_admin
18
 * @property int $user_id
19
 * @property string $ip
20
 * @property string $created_at
21
 * @property string $updated_at
22
 * @property FeedbackPost|Collection $post
23
 */
24
class FeedbackAnswer extends ActiveModel
25
{
26
    use SearchableTrait;
27
28
    protected $casts = [
29
        'id' => 'integer',
30
        'feedback_id' => 'integer',
31
        'name' => 'string',
32
        'email' => 'string',
33
        'message' => 'string',
34
        'is_admin' => 'boolean',
35
        'user_id' => 'integer',
36
        'ip' => 'string'
37
    ];
38
39
    protected $searchable = [
40
        'columns' => [
41
            'message' => 2
42
        ]
43
    ];
44
45
    /**
46
     * Get feedback post relationship
47
     * @return \Illuminate\Database\Eloquent\Relations\HasOne|FeedbackPost
48
     */
49
    public function post()
50
    {
51
        return $this->hasOne(FeedbackPost::class, 'id', 'feedback_id');
52
    }
53
}
54