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