Skip to main content

Overview

You can specify that Filter::field(), Filter::relation(), Filter::morphRelation(), Filter::morphType() and Filter::custom() filters must be required.
  • When a required filter is not used, a RequiredFilterException is thrown.
  • RequiredFilterException extends Laravels ValidationException.
    • You can let this bubble up to your controller for the default laravel 422 response.
  • This exception CAN NOT be suppressed.

Marking As Required

Relaxing The Required Scope

  • Sometimes you may want a filter to be required ONLY if it’s parent has been filtered.
    • You can set the scoped parameter to true to achieve this.