| 1 | <?php  | 
            ||
| 11 | class Setting extends Model  | 
            ||
| 12 | { | 
            ||
| 13 | /**  | 
            ||
| 14 | * @var array  | 
            ||
| 15 | */  | 
            ||
| 16 | protected $fillable = ['key', 'value'];  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * Get a single setting value. If no value is set, return null.  | 
            ||
| 20 | *  | 
            ||
| 21 | * @param string $key  | 
            ||
| 22 | * @param string|null $default  | 
            ||
| 23 | *  | 
            ||
| 24 | * @return string  | 
            ||
| 25 | */  | 
            ||
| 26 | public static function get(string $key, string $default = null)  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * Get all data in settings as an array.  | 
            ||
| 41 | *  | 
            ||
| 42 | * @return array  | 
            ||
| 43 | */  | 
            ||
| 44 | public static function getAll()  | 
            ||
| 54 | |||
| 55 | /**  | 
            ||
| 56 | * Set a setting value. If no value is provided, it is stored as null.  | 
            ||
| 57 | *  | 
            ||
| 58 | * @param string $key  | 
            ||
| 59 | * @param mixed $value  | 
            ||
| 60 | */  | 
            ||
| 61 | public static function set(string $key, $value = null)  | 
            ||
| 66 | }  | 
            ||
| 67 |