[10.x] feat add whereLike() and whereLikeContain()#46405
[10.x] feat add whereLike() and whereLikeContain()#46405Haythamasalama wants to merge 4 commits into
whereLike() and whereLikeContain()#46405Conversation
* add `whereLike()` * add `whereLikeContain()` * add `orWhereLike()` * add `orWhereLikeContain()` * add `whereNotLike()` * add `whereNotLikeContain()`
|
This has been attempted many times. Btw it does not cover all use cases. How to produce this query select * from stores where name like "apple%"
select * from stores where name like "a%e"There are many others cases |
|
Thank you. Please try to search PR's before submitting. |
You Can Use like this or other cover all use cases Stores::whereLike('name',"apple%")->get();
Stores::whereLike('name',"a%e")->get(); |
🧐 Hmm, I think it's useful, just like other query builders such as whereBetween() ...etc. and |
|
I'm surprised this is closed without any practical reason. LIKE is a very common SQL operator and probably the only one that doesn't have a helper method yet. We have helper methods for several operators like IN, NULL, BETWEEN, DATE, FULLTEXT, etc. Why is LIKE excluded? Are there any downsides? |
add methods that handle queries for performing 'where like' searches in the database.
whereLike(),whereNotLike(),orWhereLike()whereLikeContain(),whereNotLikeContain(),orWhereLikeContain()