Skip to content

Commit

Permalink
pembaruan, perbaikan dan penambahan fitur baru
Browse files Browse the repository at this point in the history
  • Loading branch information
febrihidayan committed May 24, 2020
1 parent 3456e3a commit d3b33d8
Show file tree
Hide file tree
Showing 4 changed files with 298 additions and 39 deletions.
61 changes: 55 additions & 6 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ $db = new \HilyahTech\QueryBuilder\DB($config);
* [get and first](#get-and-first)
* [where](#where)
* [where in](#where-in)
* [between](#between)
* [like](#like)
* [groupBy](#groupby)
* [having](#having)
* [orderBy](#orderby)
* [insert](#insert)
* [update](#update)
Expand Down Expand Up @@ -145,17 +149,62 @@ $db->table('users')->where([['id', 1], ['status', 1]], 'OR')->get();

### where in
```php
$db->table('users')->whereIn('id', [1, 2, 3])->get();
# sql: "SELECT * FROM users WHERE id IN (1, 2, 3)"
$db->table('test')->whereIn('id', [1, 2, 3])->get();
# sql: "SELECT * FROM test WHERE id IN (1, 2, 3)"

$db->table('test')->whereNotIn('id', [1, 2, 3])->get();
# sql: "SELECT * FROM test WHERE id NOT IN (1, 2, 3)"
```

### between
```php
$db->table('test')->between('age', 17, 25)->get();
# sql: "SELECT * FROM test WHERE age BETWEEN 17, 25"

$db->table('test')->between('age', [17, 25])->get();
# sql: "SELECT * FROM test WHERE age BETWEEN 17, 25"

$db->table('test')->notBetween('age', [17, 25])->get();
# sql: "SELECT * FROM test WHERE age NOT BETWEEN 17, 25"
```

### like
```php
$db->table('test')->like('name', '%example%')->get();
# sql: "SELECT * FROM test WHERE name LIKE %example%"

$db->table('test')->notLike('name', '%example%')->get();
# sql: "SELECT * FROM test WHERE name NOT LIKE %example%"
```

### groupBy
```php
$db->table('test')->groupBy('id')->get();
# sql: "SELECT * FROM test GROUP BY id"

$db->table('test')->groupBy(['id', 'user_id'])->get();
# sql: "SELECT * FROM test GROUP BY id, user_id"
```

### having
```php
$db->table('test')->having('COUNT(user_id)', 5)->get();
# sql: "SELECT * FROM test HAVING COUNT(user_id) > 5"

$db->table('test')->having('COUNT(user_id)', '>=', 5)->get();
# sql: "SELECT * FROM test HAVING COUNT(user_id) >= 5"

$db->table('test')->having('COUNT(user_id) > ?', [2])->get();
# sql: "SELECT * FROM test HAVING COUNT(user_id) >= 5"
```

### orderBy
```php
$db->table('users')->orderBy('name')->get();
# sql: "SELECT * FROM users ORDER BY name ASC"
$db->table('test')->orderBy('name')->get();
# sql: "SELECT * FROM test ORDER BY name ASC"

$db->table('users')->orderBy('name', 'DESC')->get();
# sql: "SELECT * FROM users ORDER BY name DESC"
$db->table('test')->orderBy('name', 'DESC')->get();
# sql: "SELECT * FROM test ORDER BY name DESC"
```

### insert
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Query Builder dengan PHP PDO dapat digunakan dengan mudah dan akses data lebih cepat.

[![Latest Stable Version](https://poser.pugx.org/hilyahtech/query-builder-php/v)](//packagist.org/packages/hilyahtech/query-builder-php) [![Total Downloads](https://poser.pugx.org/hilyahtech/query-builder-php/downloads)](//packagist.org/packages/hilyahtech/query-builder-php) [![Latest Unstable Version](https://poser.pugx.org/hilyahtech/query-builder-php/v/unstable)](//packagist.org/packages/hilyahtech/query-builder-php) [![License](https://poser.pugx.org/hilyahtech/query-builder-php/license)](//packagist.org/packages/hilyahtech/query-builder-php)

## Instalasi
Cara menginstall Query Builder PHP melalui [composer](http://getcomposer.org), kemudian jalankan perintah berikut untuk instalasi.

Expand Down
Loading

0 comments on commit d3b33d8

Please sign in to comment.