HEX
Server: nginx/1.28.3
System: Linux lightweb-s1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User: drdrivek-71 (1047)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/eslinced-103/brise-edu.or.kr/app/Http/Livewire/NewDomain.php
<?php

namespace App\Http\Livewire;

use Illuminate\Support\Str;
use Livewire\Component;

class NewDomain extends Component
{
    public $domain = '';

    public function save()
    {
        $this->validate([
            'domain' => [
                'required',
                'string',
                'unique:central.domains',
                'regex:/^[A-Za-z0-9]+[A-Za-z0-9.-]+[A-Za-z0-9]+$/',
                'regex:/\\./', // Must contain a dot
                function ($attribute, $value, $fail) {
                    if (Str::endsWith($value, config('tenancy.central_domains')[0])) {
                        $fail($attribute.' must be a custom domain.');
                    }
                },
            ],
        ]);

        $domain = tenant()->createDomain($this->domain);

        $this->emit('domainsUpdated');

        $this->domain = '';
    }

    public function render()
    {
        return view('livewire.tenant.new-domain');
    }
}