$filtered_collection = $collection->filter(function ($item) {
return $item->isDog();
})->values();
// Suppose tha my model is Tool;
Tool::all()->filter(
// Here you can filter the Tool model
fn (Tool $tool) => in_array($tag, $tool->getAttribute("tags"))
);