You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,6 +218,24 @@ You may also specify additional columns to update:
218
218
219
219
All basic insert, update, delete and select methods should be implemented.
220
220
221
+
### Dates
222
+
223
+
Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields you will need to manually specify them as described here: http://laravel.com/docs/eloquent#date-mutators
224
+
225
+
Example:
226
+
227
+
use Jenssegers\Mongodb\Model as Eloquent;
228
+
229
+
class User extends Eloquent {
230
+
231
+
protected $dates = array('birthday');
232
+
233
+
}
234
+
235
+
Which allows you to execute queries like:
236
+
237
+
$users = User::where('birthday', '>', new DateTime('-18 years'))->get();
0 commit comments