I'm making a filter for my search, my car table has a relationship with the color table so when I filter the search with the color I need a car with that color, for the example, I'm just using one filter but in my app, it actually has many filters, so I want to know which perform better to using a whereHas method for each filter like this:
$cars = Car::whereHas('colors', function ($query) use ($request){
$query->where('name', $request->color);
})->get();
or just add the color name to car table so I can just use
$cars = Car::where('color', $request->color)->get();