-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix filtering with operator not like issue #1829
Conversation
@ahmedsayedabdelsalam, let's go to slack community, you can find link here. We have channel #review for communicating about PR's |
$operator = '='; | ||
// Replace like or not like with a Regex instance. | ||
if (in_array($operator, ['like', 'not like'])) { | ||
if (Str::startsWith($operator, 'not')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do string operations here:
if (Str::startsWith($operator, 'not')) { | |
if ($operator === 'not like') { |
Any chance you could add a test as well? |
@Smolevich I think the issue is clear enough here to keep the discussion on github. I rather have discussions on Slack regarding difficult topics and see how others can help to collaborate. Moving the discussions away from github will only make it harder for people to know what's going on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Smolevich I think the issue is clear enough here to keep the discussion on github. I rather have discussions on Slack regarding difficult topics and see how others can help to collaborate.
Moving the discussions away from github will only make it harder for people to know what's going on.
Ok, I agree
if ($operator == 'like') { | ||
$operator = '='; | ||
// Replace like or not like with a Regex instance. | ||
if (in_array($operator, ['like', 'not like'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add additional test case for not like
here please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance you could add a test as well?
I added the test case and replaced the string operation as suggested.
Good stuff! |
fix filtering with operator not like issue
when filtering data with not like operator like the following example
User::where('name', 'not like', 'ahmed')
the following exception has been thrown
unknown operator: $not like
this PR fixes this issue and treated it as regex same as the like operator.