I am doing a Laravel CRUD exercise and I have set up a search route in the controller:
public function search($name)
{
return Product::where('name', 'like', '%'.$name.'%')->get();
}
And on the backend psql database, I have an item name exactly as iPhone 11.
When I ran a query on postman, it worked fine if I GET by localhost:8000/api/products/search/iPh. However, if I uncapitalised it as ...search/iph, it would return an empty array.
So my question is, what do I do so I can search with uncapitalised letters while the data stored contains capitalised letters?