Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
797106b4
Commit
797106b4
authored
Aug 09, 2014
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update readme with insert, update and delete info
parent
00249c1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletion
+34
-1
README.md
README.md
+34
-1
No files found.
README.md
View file @
797106b4
...
...
@@ -322,7 +322,40 @@ Matches documents that satisfy a JavaScript expression. For more information che
### Inserts, updates and deletes
All basic insert, update, delete and select methods should be implemented.
Inserting, updating and deleting records works just like the original Eloquent.
**Saving a new model**
$user = new User;
$user->name = 'John';
$user->save();
You may also use the create method to save a new model in a single line:
User::create(array('name' => 'John'));
**Updating a model**
o update a model, you may retrieve it, change an attribute, and use the save method.
$user = User::first();
$user->email = 'john@foo.com';
$user->save();
*There is also support for upsert operations, check https://github.com/jenssegers/laravel-mongodb#mongodb-specific-operations*
**Deleting a model**
To delete a model, simply call the delete method on the instance:
$user = User::first();
$user->delete();
Or deleting a model by its key:
User::destroy('517c43667db388101e00000f');
For more information about model manipulation, check http://laravel.com/docs/eloquent#insert-update-delete
### Dates
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment