Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/PowerDNS/DomainObserver.php
- This file was added.
<?php | |||||
namespace App\Observers\PowerDNS; | |||||
use App\PowerDNS\Domain; | |||||
class DomainObserver | |||||
{ | |||||
public function created(Domain $domain) | |||||
{ | |||||
\App\PowerDNS\Record::create( | |||||
[ | |||||
'domain_id' => $domain->id, | |||||
'name' => $domain->{'name'}, | |||||
'type' => "SOA", | |||||
machniak: Just `$domain->name` everywhere. | |||||
'content' => sprintf( | |||||
"ns.%s. hostmaster.%s. %s 1200 600 1814400 60", | |||||
$domain->{'name'}, | |||||
$domain->{'name'}, | |||||
\Carbon\Carbon::now()->format('Ymd') . '01' | |||||
) | |||||
] | |||||
); | |||||
\App\PowerDNS\Record::create( | |||||
[ | |||||
Done Inline ActionsFour of these Record::create() calls will invoke bumpSerial() on the domain. We should disable the Record 'created' event handler temporarily. Look for withoutEvents on https://stackoverflow.com/questions/29407818/is-it-possible-to-temporarily-disable-event-in-laravel/51301753 or do manual inserts. machniak: Four of these Record::create() calls will invoke bumpSerial() on the domain. We should disable… | |||||
'domain_id' => $domain->id, | |||||
'name' => $domain->{'name'}, | |||||
'type' => "NS", | |||||
'content' => "ns1." . $domain->{'name'} . "." | |||||
] | |||||
); | |||||
\App\PowerDNS\Record::create( | |||||
[ | |||||
'domain_id' => $domain->id, | |||||
'name' => "ns1." . $domain->{'name'}, | |||||
'type' => "A", | |||||
'content' => "127.0.0.1" | |||||
] | |||||
); | |||||
\App\PowerDNS\Record::create( | |||||
[ | |||||
'domain_id' => $domain->id, | |||||
'name' => $domain->{'name'}, | |||||
'type' => "NS", | |||||
'content' => "ns2." . $domain->{'name'} . "." | |||||
] | |||||
); | |||||
\App\PowerDNS\Record::create( | |||||
[ | |||||
'domain_id' => $domain->id, | |||||
'name' => "ns2." . $domain->{'name'}, | |||||
'type' => "A", | |||||
'content' => "127.0.0.1" | |||||
] | |||||
); | |||||
\App\PowerDNS\DomainSetting::create( | |||||
[ | |||||
'domain_id' => $domain->id, | |||||
'kind' => 'ENABLE-LUA-RECORDS', | |||||
'content' => "0" | |||||
] | |||||
); | |||||
} | |||||
} |
Just $domain->name everywhere.