User::preference()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace NukaCode\Users\Models\User\Preference;
4
5
use App\Models\BaseModel;
6
7
class User extends BaseModel
8
{
9
    protected $table = 'preferences_users';
10
11
    protected static $observer = 'NukaCode\Users\Models\Observers\User\Preference\UserObserver';
12
13
    public function validateValue()
14
    {
15
        return (preg_match('/' . $this->preference->value . '/', $this->value) == 1 ? true : false);
16
    }
17
18
    public function user()
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
19
    {
20
        return $this->belongsTo('NukaCode\Users\Models\User', 'user_id');
21
    }
22
23
    public function preference()
24
    {
25
        return $this->belongsTo('NukaCode\Users\Models\User\Preference', 'preference_id');
26
    }
27
}
28