-
packages/Webkul/DataTransfer/src/Rules/SeparatorTypes.php
Open in GitHubuse Closure; use Illuminate\Contracts\Validation\ValidationRule; class SeparatorTypes implements ValidationRule { const SEPERATOR_TYPES = [ ',', ';', '|', ]; public function validate(string $attribute, mixed $value, Closure $fail): void { if (! in_array($value, self::SEPERATOR_TYPES)) { $fail('core::validation.seperator-not-supported')->translate(); } } }
-
packages/Webkul/Admin/src/Http/Controllers/Settings/DataTransfer/ExportController.php
Open in GitHubuse Webkul\DataTransfer\Rules\SeparatorTypes; class ExportController extends Controller { // ... public function store() { $exporters = array_keys(config('exporters')); $this->validate(request(), [ 'code' => 'required|unique:job_instances,code', 'entity_type' => 'required|in:'.implode(',', $exporters), 'filters' => 'array', 'filters.file_format' => 'required', 'field_separator' => ['required_if:filters.file_format,Csv', new SeparatorTypes], ]); // ... } // ... }