Completed
Push — master ( bfdf74...8a4d0b )
by Stéphane
13:35
created

Field::revision()   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 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
ccs 0
cts 0
cp 0
crap 2
1
<?php namespace Rocket\Entities;
2
3
use Illuminate\Database\Eloquent\Model;
4
5
/**
6
 * Field
7
 *
8
 * @property int $id The field id
9
 * @property string $name The name of the field
10
 * @property int $weight The order of this field
11
 * @property int $revision_id The field's revision id
12
 * @property-read \DateTime $created_at
13
 * @property-read \DateTime $updated_at
14
 */
15
class Field extends Model
16
{
17 69
    public function __construct(array $attributes = [])
18
    {
19 69
        $this->bootIfNotBooted();
20
21 69
        $this->syncOriginal();
22 69
    }
23
24
    //TODO :: validate values
25
26 43
    public function toArray()
27
    {
28 43
        return $this->getAttribute('value');
29
    }
30
31
    /**
32
     * Get the revisions for this class
33
     *
34
     * @codeCoverageIgnore
35
     */
36
    public function revision()
37
    {
38
        return $this->belongsTo(Revision::class);
39
    }
40
}
41