| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- declare(strict_types=1);
- namespace App\Http\Requests;
- use App\Models\CommonCatalogItem;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rule;
- class StoreCommonCatalogItemRequest extends FormRequest
- {
- public function authorize(): bool
- {
- return true;
- }
- public function rules(): array
- {
- $item = $this->route('commonCatalogItem');
- return [
- 'article' => [
- 'required',
- 'string',
- 'max:100',
- Rule::unique('common_catalog_items', 'article')->ignore(
- $item instanceof CommonCatalogItem ? $item->getKey() : null,
- ),
- ],
- 'calculator_name' => ['required', 'string'],
- 'kind' => ['nullable', 'string', 'max:255'],
- 'dimensions' => ['nullable', 'string'],
- 'fall_height' => ['nullable', 'numeric', 'min:0'],
- 'additional_info' => ['nullable', 'string'],
- 'dimension_unit' => ['nullable', 'string', 'max:50'],
- 'weight' => ['nullable', 'numeric', 'min:0'],
- 'volume' => ['nullable', 'numeric', 'min:0'],
- 'places' => ['nullable', 'integer', 'min:0'],
- 'composition' => ['nullable', 'string'],
- 'age_group' => ['nullable', 'string', 'max:100'],
- 'max_users' => ['nullable', 'integer', 'min:0'],
- 'unit' => ['nullable', 'string', 'max:50'],
- 'series' => ['nullable', 'string', 'max:255'],
- 'trademark' => ['nullable', 'string', 'max:255'],
- 'note' => ['nullable', 'string'],
- ];
- }
- }
|