-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a826920
commit f03a1b4
Showing
1 changed file
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
## Spanner ORM Builder | ||
|
||
[](https://travis-ci.com/mgcostaParedes/spanner-orm-builder) | ||
[](https://travis-ci.com/mgcostaParedes/spanner-orm-builder) | ||
[](https://codecov.io/gh/mgcostaParedes/spanner-orm-builder) | ||
|
||
The Spanner ORM Builder is a database toolkit to PHP, providing an expressive query builder, ActiveRecord style ORM, it can serve as a database layer for your PHP app if you intend to work with **Google Cloud Spanner**. | ||
|
@@ -28,11 +28,33 @@ Once the Manager instance has been registered, we may use it like: | |
**Using The Query Builder** | ||
|
||
```PHP | ||
use MgCosta\Spanner\Model\Model; | ||
|
||
class User extends \MgCosta\Spanner\Model\Model {} | ||
class User extends Model {} | ||
|
||
$users = User::where('age', '>', 30)->get(); | ||
|
||
``` | ||
|
||
**Saving a model ** | ||
|
||
```PHP | ||
use MgCosta\Spanner\Model\Model; | ||
|
||
class User extends Model { | ||
protected $primaryKey = 'UserId'; | ||
|
||
public $name; | ||
public $age; | ||
public $email; | ||
} | ||
|
||
$user = new User(); | ||
$user->name = 'Miguel'; | ||
$user->age = 28; | ||
$user->email = '[email protected]'; | ||
$user->save(); | ||
|
||
``` | ||
|
||
The implementation of the query builder is inspired on Laravel Query Builder, to get more documentation follow the [link](https://laravel.com/docs/master/queries). |