File manager - Edit - /var/www/html/spdc/api/app/Http/Requests/ScaleFunctionRequest.php
Back
<?php namespace App\Http\Requests; use App\Rules\ArrayInput; use App\Rules\UserExists; use App\Rules\BooleanInput; use App\Rules\ValidEnumOption; use App\Enums\ScaleFunctionType; use Illuminate\Foundation\Http\FormRequest; class ScaleFunctionRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array<string, mixed> */ public function rules() { $rules = [ 'name' => ['required', 'unique:scale_functions,name'], 'enable' => ['nullable', new BooleanInput], 'type' => ['required', new ValidEnumOption(ScaleFunctionType::cases())], 'external_agents' => ['nullable', new ArrayInput], 'external_agents.*' => ['exists:external_agents,id'], 'internal_agents' => ['nullable', new ArrayInput], 'internal_agents.*' => [new UserExists()] ]; if ($this->route()->getName() === 'scale-function.update') { $rules['name'] = ['required', 'max:255', 'unique:scale_functions,name,'. $this->route('scale_function')->id]; } return $rules; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings