StoreDomainRequest.php 755 B

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