File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ A DynamoDB based Eloquent model and Query builder for Laravel.
16
16
+ [ Retrieving all models] ( #retrieving-all-models )
17
17
+ [ Retrieving a model] ( #retrieving-a-model )
18
18
+ [ save()] ( #save )
19
+ + [ create()] ( #create )
19
20
+ [ update()] ( #update )
20
21
+ [ delete()] ( #delete )
21
22
+ [ increment() / decrement()] ( #increment--decrement )
@@ -229,12 +230,21 @@ If the model has sort key and `sortKeyDefault` is defined:
229
230
User::find('foo@bar.com'); // Partition key. sortKeyDefault will be used for Sort key.
230
231
```
231
232
233
+ #### create()
234
+
235
+ ``` php
236
+ $user = User::create([
237
+ 'email' => 'foo@bar.com',
238
+ 'type' => 'profile' // Sort key. If we don't specify this, sortKeyDefault will be used.
239
+ ]);
240
+ ```
241
+
232
242
#### save()
233
243
234
244
``` php
235
245
$user = new User([
236
246
'email' => 'foo@bar.com',
237
- 'type' => 'profile' // Sort key. If we don't specify this, sortKeyDefault will be used.
247
+ 'type' => 'profile'
238
248
]);
239
249
240
250
$user->save();
Original file line number Diff line number Diff line change @@ -129,7 +129,15 @@ public static function all($columns = [])
129
129
return static ::scan ($ columns );
130
130
}
131
131
132
- public static function create (array $ fillables = [], array $ options = []){
132
+ /**
133
+ * Save a new model and return the instance.
134
+ *
135
+ * @param array $fillables
136
+ * @param array $options
137
+ * @return \Kitar\Dynamodb\Model\Model|$this
138
+ */
139
+ public static function create (array $ fillables = [], array $ options = [])
140
+ {
133
141
$ instance = new static ($ fillables );
134
142
$ instance ->save ($ options );
135
143
return $ instance ;
You can’t perform that action at this time.
0 commit comments