BatchCreateRequest.php 865 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Requests\API\Task;
  3. use App\Http\Requests\RuleHelper;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. use Illuminate\Validation\Rule;
  6. class BatchCreateRequest extends FormRequest
  7. {
  8. use RuleHelper;
  9. /**
  10. * Determine if the user is authorized to make this request.
  11. */
  12. public function authorize(): bool
  13. {
  14. return true;
  15. }
  16. /**
  17. * Get the validation rules that apply to the request.
  18. *
  19. * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
  20. */
  21. public function rules(): array
  22. {
  23. return [
  24. 'project_id' => [
  25. 'required',
  26. Rule::exists('projects', 'id')->where($this->userCompanyWhere()),
  27. ],
  28. 'items' => [
  29. 'required', 'array'
  30. ]
  31. ];
  32. }
  33. }