-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathUpdateStatusPageMaintenanceStarted.php
More file actions
32 lines (27 loc) · 1.01 KB
/
UpdateStatusPageMaintenanceStarted.php
File metadata and controls
32 lines (27 loc) · 1.01 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
<?php
namespace SampleApp\Listeners;
use MisterPhilip\MaintenanceMode\Events\MaintenanceModeEnabled;
use CheckItOnUs\StatusPage;
/**
* Class UpdateStatusPageMaintenanceStarted
*
* This uses the CheckItOnUs Statuspage SDK (https://github.com/checkitonus/php-statuspage-sdk) to update a
* Statuspage (https://www.statuspage.io) that maintenance has started.
*
* This is assuming a little bit of setup has been done already, e.g.:
* - A config file has been added for the statuspage with an API key (and component ID)
* - A statuspage and component has been setup, and the component ID set in the config file
*/
class UpdateStatusPageMaintenanceStarted
{
public function handle(MaintenanceModeEnabled $maintenanceMode)
{
$server = new StatusPage\Server([
'api_key' => config('statuspage.key'),
]);
StatusPage\Component::on($server)
->findById(config('statuspage.component'))
->setStatus(Component::UNDER_MAINTENANCE)
->update();
}
}