Completed
Push — api/develop ( c97cc3...64624d )
by Bertrand
10:00
created

CustomField::section()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of the HRis Software package.
5
 *
6
 * HRis - Human Resource and Payroll System
7
 *
8
 * @link http://github.com/HB-Co/HRis
9
 */
10
namespace HRis\Api\Eloquent;
11
12
use Illuminate\Database\Eloquent\Model;
13
14
/**
15
 * Class CustomField.
16
 */
17
class CustomField extends Model
18
{
19
    /**
20
     * Indicates if the model should be timestamped.
21
     *
22
     * @var bool
23
     */
24
    public $timestamps = false;
25
26
    /**
27
     * The attributes that are mass assignable.
28
     *
29
     * @var array
30
     */
31
    protected $fillable = ['custom_field_section_id', 'name', 'custom_field_type_id', 'required', 'mask'];
32
33
    /**
34
     * The database table used by the model.
35
     *
36
     * @var string
37
     */
38
    protected $table = 'custom_fields';
39
40
    /**
41
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45 8
    public function type()
46
    {
47 8
        return $this->hasOne(CustomFieldType::class, 'id', 'custom_field_type_id');
48
    }
49
50
    /**
51
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
52
     *
53
     * @author Bertrand Kintanar <[email protected]>
54
     */
55
    public function section()
56
    {
57
        return $this->belongsTo(CustomFieldSection::class);
58
    }
59
60
    /**
61
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
62
     *
63
     * @author Bertrand Kintanar <[email protected]>
64
     */
65 8
    public function options()
66
    {
67 8
        return $this->hasMany(CustomFieldOption::class, 'custom_field_id', 'id');
68
    }
69
}
70