Passed
Push — master ( 68443e...939347 )
by Mihail
04:31
created

FeedbackPost::getAnswers()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Apps\ActiveRecord;
4
5
use Ffcms\Core\Arch\ActiveModel;
6
7
/**
8
 * Class FeedbackPost. Active model for feedback requests posts.
9
 * @package Apps\ActiveRecord
10
 * @property int $id
11
 * @property string $name
12
 * @property string $email
13
 * @property string $message
14
 * @property int $readed
15
 * @property int $closed
16
 * @property string $hash
17
 * @property int $user_id
18
 * @property string $ip
19
 * @property string $created_at
20
 * @property string $updated_at
21
 */
22
class FeedbackPost extends ActiveModel
23
{
24
25
    /**
26
     * Get all answers for this feedback post id
27
     * @return \Illuminate\Database\Eloquent\Relations\HasMany|null
28
     */
29
    public function getAnswers()
30
    {
31
        if ($this->id === null) {
32
            return null;
33
        }
34
35
        return $this->hasMany('Apps\ActiveRecord\FeedbackAnswer', 'feedback_id');
36
    }
37
38
}