1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/app/Http/ValidationRules/Company/ValidSubdomain.php
2024-08-30 16:17:09 +10:00

34 lines
770 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\ValidationRules\Company;
use App\Libraries\MultiDB;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
/**
* Class ValidSubdomain.
*/
class ValidSubdomain implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if(empty($value))
return;
if (!MultiDB::checkDomainAvailable($value)) {
$fail(ctrans('texts.subdomain_taken'));
}
}
}