1 | <?php |
||
10 | class Setting extends Model implements HasMedia |
||
|
|||
11 | { |
||
12 | use InteractsWithMedia; |
||
13 | |||
14 | /** |
||
15 | * The attributes that are mass assignable. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $fillable = [ |
||
20 | 'key', 'name', 'value', 'cast' |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * The attributes that should be cast. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $casts = [ |
||
29 | 'cast' => 'collection' |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * The accessors to append to the model's array form. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $appends = [ |
||
38 | 'type', 'extra' |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * Get field's type. |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getTypeAttribute() |
||
50 | |||
51 | /** |
||
52 | * Get Extra field's attributes. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getExtraAttribute() |
||
60 | |||
61 | /** |
||
62 | * Return the value for the given key. |
||
63 | * |
||
64 | * @param Builder $query |
||
65 | * @param string $key |
||
66 | * @param null $default |
||
67 | * @return string|null |
||
68 | */ |
||
69 | public function scopeGetValueFor(Builder $query, $key, $default = null) |
||
73 | } |
||
74 |