Filebase icon indicating copy to clipboard operation
Filebase copied to clipboard

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

Open faryar76 opened this issue 5 years ago • 5 comments

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 , ...

.

faryar76 avatar Feb 25 '19 00:02 faryar76

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%
<!-- Total: 24 25
Files with Coverage Reduction New Missed Lines %
src/Database.php 1 74.1%
<!-- Total: 1
Totals Coverage Status
Change from base Build 148: -0.2%
Covered Lines: 538
Relevant Lines: 568

💛 - Coveralls

coveralls avatar Feb 25 '19 00:02 coveralls

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.

timothymarois avatar Feb 25 '19 18:02 timothymarois

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

faryar76 avatar Feb 25 '19 19:02 faryar76

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)

timothymarois avatar Feb 25 '19 19:02 timothymarois

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

faryar76 avatar Feb 25 '19 22:02 faryar76