Theme   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 25
dl 0
loc 70
rs 10
c 1
b 0
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A scopeEnabledThemes() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class Theme extends Model
9
{
10
    use SoftDeletes;
11
12
    /**
13
     * The database table used by the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'themes';
18
19
    /**
20
     * The attributes that are not mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $guarded = [
25
        'id',
26
    ];
27
28
    /**
29
     * Fillable fields for a Profile.
30
     *
31
     * @var array
32
     */
33
    protected $fillable = [
34
        'name',
35
        'link',
36
        'notes',
37
        'status',
38
        'taggable_id',
39
        'taggable_type',
40
    ];
41
42
    /**
43
     * Typecasting is awesome.
44
     *
45
     * @var array
46
     */
47
    protected $casts = [
48
        'id'            => 'integer',
49
        'name'          => 'string',
50
        'link'          => 'string',
51
        'notes'         => 'string',
52
        'status'        => 'boolean',
53
        'taggable_id'   => 'integer',
54
        'taggable_type' => 'string',
55
    ];
56
57
    /**
58
     * The attributes that should be mutated to dates.
59
     *
60
     * @var array
61
     */
62
    protected $dates = [
63
        'created_at',
64
        'updated_at',
65
        'deleted_at',
66
    ];
67
68
    /**
69
     * Scope a query to get enabled themes.
70
     *
71
     * @param \Illuminate\Database\Eloquent\Builder $query
72
     *
73
     * @return \Illuminate\Database\Eloquent\Builder
74
     */
75
    public function scopeEnabledThemes($query)
76
    {
77
        return $query->where('status', 1);
78
    }
79
}
80