Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

app/Rules/ValidLicense.php

Open in GitHub
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Http;
 
class ValidLicense implements Rule
{
public function passes($attribute, $value)
{
return config('app.cloud') || $this->checkLicense($value);
}
 
protected function checkLicense(string $license): bool
{
if (app()->environment('local')) {
return true;
}
 
return Http::get("https://archboard.io/verify/{$license}")
->json('valid');
}
 
public function message()
{
return 'The validation error message.';
}
}

app/Forms/Traits/ValidatesTenantFields.php

Open in GitHub
use App\Models\Tenant;
use App\Rules\ValidLicense;
use Illuminate\Validation\Rule;
 
trait ValidatesTenantFields
{
public function licenseRules(Tenant $tenant): array
{
return [
'required',
'uuid',
new ValidLicense(),
Rule::unique('tenants', 'license')->ignoreModel($tenant),
];
}
 
// ...
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.