DEV Community 👩‍💻👨‍💻

Michael
Michael

Posted on

Determining if multiple inputs have values with Laravel

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']) {
    //
}
Enter fullscreen mode Exit fullscreen mode

The anyFilled method will return true if any of the inputs given in the array contain a non-empty value.

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠