Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

add ability to search with where* like whereName whereCountry ... #51

Open
wants to merge 18 commits into
base: 1.0
Choose a base branch
from

Conversation

faryar76
Copy link
Contributor

@faryar76 faryar76 commented Feb 25, 2019

in normal mode can search in db with

$db->where('name','==','sam')->first(); //working

with this commit changes can search in other way easy and shorter :

$db->whereName('sam')->first(); // equals ('name','==','sam') //working

also can set oparator

$db->whereName('like','sam')->first(); // equals ('name','like','sam') //working

where* can be use for all custom names like whereEmail, whereHGFJH , ...

.

@coveralls
Copy link

coveralls commented Feb 25, 2019

Pull Request Test Coverage Report for Build 157

  • 24 of 25 (96.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 94.718%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Query.php 15 16 93.75%
Files with Coverage Reduction New Missed Lines %
src/Database.php 1 74.1%
Totals Coverage Status
Change from base Build 148: -0.2%
Covered Lines: 538
Relevant Lines: 568

💛 - Coveralls

@faryar76 faryar76 changed the title add ability add ability to search with where* like whereName whereCountry ... Feb 25, 2019
@faryar76 faryar76 closed this Feb 25, 2019
@faryar76 faryar76 reopened this Feb 25, 2019
@timothymarois
Copy link
Member

I like the simplicity. To confirm, using whereUserProfile() would be user_profile as the column/field? Off-topic, but eventually I do want to include more of a Laravel-style collection on these results. I know we have the Document class, but we do need more functionality with that. Most likely will be a V2 or a 1.1. Also, are you on Slack? Should be a join link in the readme. Would love to connect.

@faryar76
Copy link
Contributor Author

faryar76 commented Feb 25, 2019

hi, for your example, look like this
whereUser_profile
But with a little change it can be similar to laravel_query_builder.

Thanks about slack I joined

@timothymarois
Copy link
Member

hi, for your example, look like this
whereUser_profile
But with a little change it can be similar to laravel_query_builder.

I would recommend we make it so
whereUserProfile('Tim') = the same as WHERE user_profile = 'Tim'
This way it's more universal to understand (and we don't mismatch, always using camel-case in methods)

@faryar76
Copy link
Contributor Author

faryar76 commented Feb 25, 2019

now can select "user" with
$db->query()->whereUser('data')->first();//will work
also
$db->query()->whereuser_profile_is_with_some_query('data')->first(); //edited : will not work
to select "User"
whereUser or whereuser

to select "UserOwner"
whereUserowner or whereuserowner

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants