<?php
 namespace App\Http\Requests\Admin; use Illuminate\Foundation\Http\FormRequest; class ProductConfigOptionUpdateRequest extends FormRequest { public function authorize(): bool { return $this->user()->can('update', $this->route('productConfigOption')); } public function rules(): array { return [ 'group_id' => 'required|exists:product_config_option_groups,id', 'name' => 'required|string|max:255', 'description' => 'nullable|string|max:1000', 'type' => 'required|in:number,select,checkboxgroup,text,checkbox,ip_address', 'order' => 'nullable|integer|min:0', 'hidden' => 'nullable|boolean', 'is_required' => 'nullable|boolean', 'adaptive_term_pricing' => 'nullable|boolean', 'ip_pool_override_id' => 'nullable|integer|exists:ip_pools,id', 'option_value' => 'nullable|string|max:255', 'pricing_grid_option' => 'sometimes|array', 'pricing_grid_option.*' => 'sometimes|array', 'pricing_grid_option.*.*' => 'nullable|numeric|min:0', 'values_list' => 'sometimes|array', 'values_list.*.id' => 'nullable|integer|exists:product_config_option_values,id', 'values_list.*.value' => 'nullable|string|max:255', 'pricing_grid' => 'sometimes|array', 'pricing_grid.*' => 'sometimes|array', 'pricing_grid.*.*' => 'sometimes|array', 'pricing_grid.*.*.*' => 'nullable|numeric|min:0', ]; } public function messages(): array { return [ 'group_id.required' => __('admin/validation.product_config_option_group_id_required'), 'group_id.exists' => __('admin/validation.product_config_option_group_id_exists'), 'name.required' => __('admin/validation.product_config_option_name_required'), 'name.max' => __('admin/validation.product_config_option_name_max'), 'description.max' => __('admin/validation.product_config_option_description_max'), 'type.required' => __('admin/validation.product_config_option_type_required'), 'type.in' => __('admin/validation.product_config_option_type_in'), 'minimum.integer' => __('admin/validation.product_config_option_minimum_integer'), 'minimum.min' => __('admin/validation.product_config_option_minimum_min'), 'maximum.integer' => __('admin/validation.product_config_option_maximum_integer'), 'maximum.min' => __('admin/validation.product_config_option_maximum_min'), 'order.integer' => __('admin/validation.product_config_option_order_integer'), 'order.min' => __('admin/validation.product_config_option_order_min'), 'hidden.boolean' => __('admin/validation.product_config_option_hidden_boolean'), 'is_required.boolean' => __('admin/validation.product_config_option_is_required_boolean'), 'pricing.array' => __('admin/validation.product_config_option_pricing_array'), 'pricing.*.period.required' => __('admin/validation.product_config_option_pricing_period_required'), 'pricing.*.period.integer' => __('admin/validation.product_config_option_pricing_period_integer'), 'pricing.*.period.min' => __('admin/validation.product_config_option_pricing_period_min'), 'pricing.*.time.required' => __('admin/validation.product_config_option_pricing_time_required'), 'pricing.*.time.in' => __('admin/validation.product_config_option_pricing_time_in'), 'pricing.*.amount.required' => __('admin/validation.product_config_option_pricing_amount_required'), 'pricing.*.amount.numeric' => __('admin/validation.product_config_option_pricing_amount_numeric'), 'pricing.*.amount.min' => __('admin/validation.product_config_option_pricing_amount_min'), 'pricing.*.setup_amount.numeric' => __('admin/validation.product_config_option_pricing_setup_amount_numeric'), 'pricing.*.setup_amount.min' => __('admin/validation.product_config_option_pricing_setup_amount_min'), 'pricing.*.currency_id.exists' => __('admin/validation.product_config_option_pricing_currency_id_exists'), 'pricing.*.order.integer' => __('admin/validation.product_config_option_pricing_order_integer'), 'pricing.*.order.min' => __('admin/validation.product_config_option_pricing_order_min'), ]; } public function attributes(): array { return [ 'group_id' => 'grup', 'name' => 'opsiyon adı', 'description' => 'açıklama', 'type' => 'tip', 'minimum' => 'minimum değer', 'maximum' => 'maksimum değer', 'order' => 'sıralama', 'hidden' => 'gizli', 'is_required' => 'zorunlu', 'pricing' => 'fiyatlandırma', ]; } } 