39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Administration;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class StoreTenantRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->can('tenant.create') ?? false;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'slug' => ['required', 'alpha_dash', 'max:100', 'unique:tenants,slug'],
|
|
'is_active' => ['sometimes', 'boolean'],
|
|
'owner_name' => ['required', 'string', 'max:255'],
|
|
'owner_email' => ['required', 'email', 'max:255', 'unique:users,email'],
|
|
'owner_password' => ['required', 'confirmed', Password::min(12)->mixedCase()->numbers()->symbols()],
|
|
'deployment_type' => ['sometimes', 'in:managed_cloud,self_hosted'],
|
|
'deployment_domain' => ['nullable', 'string', 'max:255'],
|
|
'plan_code' => ['sometimes', 'string', 'in:cloud_free,cloud_micro,cloud_isp,local_micro,local_isp'],
|
|
];
|
|
}
|
|
}
|