Completed
Push — master ( a3496d...130652 )
by Jeremy
15:26
created

BlogSetting   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A scopeThemeId() 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 BlogSetting extends Model
9
{
10
    use SoftDeletes;
11
12
    /**
13
     * The database table used by the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'blog_settings';
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
        'key',
36
        'value',
37
        'active',
38
    ];
39
40
    /**
41
     * Typecasting is awesome.
42
     *
43
     * @var array
44
     */
45
    protected $casts = [
46
        'name'      => 'string',
47
        'key'       => 'string',
48
        'value'     => 'string',
49
        'active'    => 'boolean',
50
    ];
51
52
    /**
53
     * The attributes that should be mutated to dates.
54
     *
55
     * @var array
56
     */
57
    protected $dates = [
58
        'created_at',
59
        'updated_at',
60
        'deleted_at',
61
    ];
62
63
    /**
64
     * Scope a query to get the themeId from the settings table.
65
     *
66
     * @param \Illuminate\Database\Eloquent\Builder $query
67
     *
68
     * @return \Illuminate\Database\Eloquent\Builder
69
     */
70
    public function scopeThemeId($query)
71
    {
72
        return $query->where('key', 'blog_theme_id');
73
    }
74
}
75