Have you ever tried running a search in a nested JSON column inside a database with laravel where() method and it didn't work the way you expected it to due to case sensitivity(Example 1).
But Same query works when the case match(Example 2)
To overcome this challenge I came up with this modification which allowed searching with whatever case return matching results(Example 3 and 4).
Hope this helps anyone who might face this challenge. Please Let me know if there are better ways to achieve this. Your contributions and criticism are welcome. Thank you for reading this far..... and just in case you need a package to handle the query for you in a laravel project then you can just run
composer require boadusamuel/search-nested-json-column
or read on the package at boadusamuel/search-nested-json-column
Top comments (1)
that does not really look like a good choice considering the performance. wouldn't it be easier just to search in lowercase?
stackoverflow.com/a/59000485