-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from marvinosswald/master
::create() - improve compliance with laravel model by providing static create method
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ A DynamoDB based Eloquent model and Query builder for Laravel. | |
+ [Retrieving all models](#retrieving-all-models) | ||
+ [Retrieving a model](#retrieving-a-model) | ||
+ [save()](#save) | ||
+ [create()](#create) | ||
+ [update()](#update) | ||
+ [delete()](#delete) | ||
+ [increment() / decrement()](#increment--decrement) | ||
|
@@ -229,12 +230,21 @@ If the model has sort key and `sortKeyDefault` is defined: | |
User::find('[email protected]'); // Partition key. sortKeyDefault will be used for Sort key. | ||
``` | ||
|
||
#### create() | ||
|
||
```php | ||
$user = User::create([ | ||
'email' => '[email protected]', | ||
'type' => 'profile' // Sort key. If we don't specify this, sortKeyDefault will be used. | ||
]); | ||
``` | ||
|
||
#### save() | ||
|
||
```php | ||
$user = new User([ | ||
'email' => '[email protected]', | ||
'type' => 'profile' // Sort key. If we don't specify this, sortKeyDefault will be used. | ||
'type' => 'profile' | ||
]); | ||
|
||
$user->save(); | ||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Kitar\Dynamodb\Tests\Model; | ||
|
||
use Kitar\Dynamodb\Model\Model; | ||
use Illuminate\Auth\Authenticatable; | ||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
|
||
class UserD extends Model implements AuthenticatableContract | ||
{ | ||
use Authenticatable; | ||
|
||
protected $table = 'User'; | ||
protected $primaryKey = 'partition'; | ||
protected $fillable = [ | ||
'partition' | ||
]; | ||
public $timestamps = false; | ||
} |