CombinationSettingRequest.php 796 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Http\Requests\API\NamingRule;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Validation\Rule;
  5. class CombinationSettingRequest extends FormRequest
  6. {
  7. /**
  8. * Determine if the user is authorized to make this request.
  9. */
  10. public function authorize(): bool
  11. {
  12. return true;
  13. }
  14. /**
  15. * Get the validation rules that apply to the request.
  16. *
  17. * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
  18. */
  19. public function rules(): array
  20. {
  21. return [
  22. "*.field" => [
  23. "required",
  24. Rule::exists("custom_fields", "key")->where("group", $this->route("naming_rule"))
  25. ],
  26. "*.link" => "required"
  27. ];
  28. }
  29. }