-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathAppSettings.php
More file actions
59 lines (38 loc) · 1.25 KB
/
AppSettings.php
File metadata and controls
59 lines (38 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace Cachet\Settings;
use Spatie\LaravelSettings\Exceptions\MissingSettings;
use Spatie\LaravelSettings\Settings;
class AppSettings extends Settings
{
public string $install_id;
public ?string $name = 'Cachet';
public ?string $about;
public bool $show_support = true;
public string $timezone = 'UTC';
public bool $show_timezone = false;
public bool $only_disrupted_days = false;
public int $incident_days = 7;
public ?int $refresh_rate;
public bool $dashboard_login_link = true;
public int $major_outage_threshold = 25;
public bool $recent_incidents_only = false;
public int $recent_incidents_days = 7;
public bool $api_enabled = true;
public bool $api_protected = false;
public bool $display_graphs = true;
public static function group(): string
{
return 'app';
}
public static function getOrDefault(string $name, mixed $default = null): mixed
{
try {
return app(self::class)->$name;
} catch (MissingSettings $exception) {
if(! app()->runningInConsole()) {
throw new \Exception("Please run `php artisan migrate` to load missing settings.");
}
}
return $default;
}
}