[Vuejs]-How to skip the key of a json if the value is not filled? Laravel Vue Javascript

0👍

You need to use filled instead of has if you want to check if a value is present on the request and is not empty.

......

if ($request->filled('fuel')) {
    $car = $car->where('fuel', $request->input('fuel'))->with('images');
}

......

See: https://laravel.com/docs/5.8/requests – Section: Determining If An Input Value Is Present

Leave a comment