Passed
Push — master ( ebbbe1...4650a2 )
by James
08:48
created

Note::setTextAttribute()   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 1
1
<?php
2
/**
3
 * Note.php
4
 * Copyright (c) 2017 [email protected]
5
 *
6
 * This file is part of Firefly III.
7
 *
8
 * Firefly III is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * Firefly III is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace FireflyIII\Models;
24
25
use Illuminate\Database\Eloquent\Model;
26
27
/**
28
 * Class Note.
29
 */
30
class Note extends Model
31
{
32
    /**
33
     * The attributes that should be casted to native types.
34
     *
35
     * @var array
36
     */
37
    protected $casts
38
        = [
39
            'created_at' => 'datetime',
40
            'updated_at' => 'datetime',
41
            'deleted_at' => 'datetime',
42
        ];
43
    /** @var array */
44
    protected $fillable = ['title', 'text', 'noteable_id', 'noteable_type'];
45
46
    /**
47
     * @codeCoverageIgnore
48
     *
49
     * Get all of the owning noteable models.
50
     */
51
    public function noteable()
52
    {
53
        return $this->morphTo();
54
    }
55
56
    /**
57
     * @param $value
58
     */
59
    public function setTextAttribute($value)
60
    {
61
        $this->attributes['text'] = e($value);
62
    }
63
}
64