StoreDomainRequest.php 841 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Http\Requests;
  3. use App\Rules\NotLocalDomain;
  4. use App\Rules\NotUsedAsRecipientDomain;
  5. use App\Rules\ValidDomain;
  6. use Illuminate\Foundation\Http\FormRequest;
  7. class StoreDomainRequest extends FormRequest
  8. {
  9. /**
  10. * Determine if the user is authorized to make this request.
  11. *
  12. * @return bool
  13. */
  14. public function authorize()
  15. {
  16. return true;
  17. }
  18. /**
  19. * Get the validation rules that apply to the request.
  20. *
  21. * @return array
  22. */
  23. public function rules()
  24. {
  25. return [
  26. 'domain' => [
  27. 'required',
  28. 'string',
  29. 'max:50',
  30. 'unique:domains',
  31. new ValidDomain,
  32. new NotLocalDomain,
  33. new NotUsedAsRecipientDomain
  34. ]
  35. ];
  36. }
  37. }