1 | <?php |
||
14 | class Monitor extends Model |
||
15 | { |
||
16 | use SupportsUptimeCheck; |
||
17 | use SupportsCertificateCheck; |
||
18 | use MonitorPresenter; |
||
19 | |||
20 | protected $guarded = []; |
||
21 | |||
22 | protected $appends = ['raw_url']; |
||
23 | |||
24 | protected $dates = [ |
||
25 | 'uptime_last_check_date', |
||
26 | 'uptime_status_last_change_date', |
||
27 | 'uptime_check_failed_event_fired_on_date', |
||
28 | 'certificate_expiration_date', |
||
29 | ]; |
||
30 | |||
31 | protected $casts = [ |
||
32 | 'uptime_check_enabled' => 'boolean', |
||
33 | 'certificate_check_enabled' => 'boolean', |
||
34 | ]; |
||
35 | |||
36 | public function getUptimeCheckAdditionalHeadersAttribute($additionalHeaders) |
||
42 | |||
43 | public function setUptimeCheckAdditionalHeadersAttribute(array $additionalHeaders) |
||
47 | |||
48 | public function scopeEnabled($query) |
||
54 | |||
55 | /** |
||
56 | * @return \Spatie\Url\Url|null |
||
57 | */ |
||
58 | public function getUrlAttribute() |
||
66 | |||
67 | /** |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getRawUrlAttribute() |
||
74 | |||
75 | public static function boot() |
||
85 | |||
86 | public function isHealthy() |
||
98 | |||
99 | /** |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function enable() |
||
114 | |||
115 | /** |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function disable() |
||
127 | |||
128 | protected static function alreadyExists(self $monitor): bool |
||
138 | } |
||
139 |