I know that the collection does not support where LIKE is, but how can I achieve this.
My details:

collect($products)->where('name', 'LIKE', '%'. $productName . '%');
Laravel does not support, as in the collection. I think to use
collect($products)->filter( function () use ($productName) {
return preg_match(pattern, subject);
})
but I don’t know how to do it. Ty
source
share