Skip to main content

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

Read more here

luadotsh/lua

324 stars
1 code files
View luadotsh/lua on GitHub

app/Http/Requests/Domain/CreateRequest.php

Open in GitHub
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
 
class CreateRequest extends FormRequest
{
public function rules(): array
{
return [
'domain' => [
'required',
'regex:/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i', // no schema
Rule::unique('domains')
->whereNull('deleted_at'),
Rule::notIn(config('domains.available'))
],
'not_found_url' => ['nullable', 'max:255', 'url'],
'expired_url' => ['nullable', 'max:255', 'url'],
];
}
 
public function messages()
{
return [
'domain.regex' => 'The domain format is invalid.',
'domain.unique' => 'The domain has already been taken.',
'domain.not_in' => 'The domain is not allowed.',
];
}
}

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.