invoiceninja/app/Listeners/DNSListener.php
David Bomba 8e7b53fd26
Refactor Cloudflare DNS to add and remove A records for custom domains (#1905)
* Refactor Cloudflare DNS to add and remove A records for custom domains

* rebase
2018-02-20 21:14:21 +11:00

31 lines
586 B
PHP

<?php
namespace App\Listeners;
use App\Events\SubdomainWasRemoved;
use App\Events\SubdomainWasUpdated;
use App\Ninja\DNS\Cloudflare;
/**
* Class DNSListener.
*/
class DNSListener
{
/**
* @param DNSListener $event
*/
public function addDNSRecord(SubdomainWasUpdated $event)
{
if(env("CLOUDFLARE_DNS_ENABLED"))
Cloudflare::addDNSRecord($event->account);
}
public function removeDNSRecord(SubdomainWasRemoved $event)
{
if(env("CLOUDFLARE_DNS_ENABLED"))
Cloudflare::removeDNSRecord($event->account);
}
}