user()->can('update', $this->route('vm')); } public function rules(): array { return [ 'name' => ['sometimes', 'string', 'max:100', 'regex:/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/'], 'cpu' => ['sometimes', 'integer', 'min:1', 'max:32'], 'ram' => ['sometimes', 'integer', 'min:512', 'max:131072'], 'disk' => ['sometimes', 'integer', 'min:10', 'max:2048'], 'devices' => ['nullable', 'array'], 'devices.*.type' => ['required_with:devices', Rule::in(array_keys(\App\Models\VmDevice::typesFor($this->user())))], 'devices.*.slot' => ['nullable', 'string', 'max:32'], 'devices.*.config' => ['nullable', 'array'], ]; } }