An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
<?php
namespace App\Livewire\Notifications\Concerns;
trait TogglesNotificationEvents
{
private const NOTIFICATION_EVENT_KEYS = [
'deploymentSuccess',
'deploymentFailure',
'statusChange',
'restartLimitReached',
'backupSuccess',
'backupFailure',
'scheduledTaskSuccess',
'scheduledTaskFailure',
'dockerCleanupSuccess',
'dockerCleanupFailure',
'serverDiskUsage',
'serverReachable',
'serverUnreachable',
'serverPatch',
'traefikOutdated',
];
public function toggleEvent(string $property): void
{
$channel = class_basename(static::class);
$allowedProperties = array_map(
static fn (string $event): string => $event.$channel.'Notifications',
self::NOTIFICATION_EVENT_KEYS,
);
abort_unless(in_array($property, $allowedProperties, true), 404);
$this->{$property} = ! $this->{$property};
try {
$this->saveModel();
} catch (\Throwable $e) {
$this->{$property} = ! $this->{$property};
$this->settings->refresh();
handleError($e, $this);
}
}
}