Now we're getting to the facility filtering. Imagine you search for a property, you have a list, and then you want to have additional filters: swimming pool, pets allowed, etc.

Goals of This Lesson
- Create a DB Structure for Property Facilities
- Build a list of the most popular facilities - two ways
- Restructure search results to include facilities
- Property filter by facility
By the end of this lesson, we will have this test passing in Terminal:

New "Type": Property Facilities
Browsing through Booking.com, I realized one more thing: these are all facilities, but they don't belong to the apartments. There are also property facilities, more global things like parking, non-smoking areas, etc...
$allfacilities = $properties->pluck('facilities')->flatten();
$facilities = $allfacilities->groupBy('name')->mapWithKeys(function($items, $key){ return [$key => count($items)]; });
maybe a bit more readable to get the count using collection.
It really depends on how good you are with collections. Sure, it is almost the same code, but in the end - it's just another way of writing it! So you whatever you see fit :)
All my PropertySearchTest.php is failing and the intructions is very unclear. Tried to see the github repo but still failed the test.
Can you expand a bit on how they fail? What is the error message?
The instructions are to add properties to tthe search structure.
For example in the first test in PropertySearchTest, formally we had
Right? but now we refactor it to