File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,40 @@ Matches documents that satisfy a JavaScript expression. For more information che
322322
323323### Inserts, updates and deletes
324324
325- All basic insert, update, delete and select methods should be implemented.
325+ Inserting, updating and deleting records works just like the original Eloquent.
326+
327+ ** Saving a new model**
328+
329+ $user = new User;
330+ $user->name = 'John';
331+ $user->save();
332+
333+ You may also use the create method to save a new model in a single line:
334+
335+ User::create(array('name' => 'John'));
336+
337+ ** Updating a model**
338+
339+ o update a model, you may retrieve it, change an attribute, and use the save method.
340+
341+ $user = User::first();
342+ $user->email = 'john@foo.com';
343+ $user->save();
344+
345+ * There is also support for upsert operations, check https://github.com/jenssegers/laravel-mongodb#mongodb-specific-operations *
346+
347+ ** Deleting a model**
348+
349+ To delete a model, simply call the delete method on the instance:
350+
351+ $user = User::first();
352+ $user->delete();
353+
354+ Or deleting a model by its key:
355+
356+ User::destroy('517c43667db388101e00000f');
357+
358+ For more information about model manipulation, check http://laravel.com/docs/eloquent#insert-update-delete
326359
327360### Dates
328361
You can’t perform that action at this time.
0 commit comments