Although it doesn't appear in the docs Laravel has a handy method to determine if the HTTP request contains one or more inputs with values:
if ($request->anyFilled(['name', 'type', 'status']) {
//
}
The anyFilled
method will return true
if any of the inputs given in the array contain a non-empty value.
Top comments (0)