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
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,15 +106,15 @@ Eloquent
106
106
This package includes a MongoDB enabled Eloquent class that you can use to define models for corresponding collections.
107
107
108
108
```php
109
-
use Jenssegers\Mongodb\Model as Eloquent;
109
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
110
110
111
111
class User extends Eloquent {}
112
112
```
113
113
114
114
Note that we did not tell Eloquent which collection to use for the `User` model. Just like the original Eloquent, the lower-case, plural name of the class will be used as the table name unless another name is explicitly specified. You may specify a custom collection (alias for table) by defining a `collection` property on your model:
115
115
116
116
```php
117
-
use Jenssegers\Mongodb\Model as Eloquent;
117
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
118
118
119
119
class User extends Eloquent {
120
120
@@ -126,7 +126,7 @@ class User extends Eloquent {
126
126
**NOTE:** Eloquent will also assume that each collection has a primary key column named id. You may define a `primaryKey` property to override this convention. Likewise, you may define a `connection` property to override the name of the database connection that should be used when utilizing the model.
127
127
128
128
```php
129
-
use Jenssegers\Mongodb\Model as Eloquent;
129
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
130
130
131
131
class MyModel extends Eloquent {
132
132
@@ -142,7 +142,7 @@ Everything else works just like the original Eloquent model. Read more about the
142
142
You may also register an alias for the MongoDB model by adding the following to the alias array in `app/config/app.php`:
This will allow you to use the registered alias like:
@@ -232,10 +232,10 @@ MongoDB Support => enabled
232
232
233
233
#### Argument 2 passed to Illuminate\Database\Query\Builder::__construct() must be an instance of Illuminate\Database\Query\Grammars\Grammar, null given
234
234
235
-
To solve this, you will need to check two things. First check if your model is extending the correct class; this class should be `Jenssegers\Mongodb\Model`. Secondly, check if your model is using a MongoDB connection. If you did not change the default database connection in your database configuration file, you need to specify the MongoDB enabled connection. This is what your class should look like if you did not set up an alias and change the default database connection:
235
+
To solve this, you will need to check two things. First check if your model is extending the correct class; this class should be `Jenssegers\Mongodb\Eloquent\Model`. Secondly, check if your model is using a MongoDB connection. If you did not change the default database connection in your database configuration file, you need to specify the MongoDB enabled connection. This is what your class should look like if you did not set up an alias and change the default database connection:
236
236
237
237
```php
238
-
use Jenssegers\Mongodb\Model as Eloquent;
238
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
239
239
240
240
class User extends Eloquent {
241
241
@@ -530,7 +530,7 @@ Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate ob
530
530
Example:
531
531
532
532
```php
533
-
use Jenssegers\Mongodb\Model as Eloquent;
533
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
534
534
535
535
class User extends Eloquent {
536
536
@@ -557,7 +557,7 @@ Supported relations are:
557
557
Example:
558
558
559
559
```php
560
-
use Jenssegers\Mongodb\Model as Eloquent;
560
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
561
561
562
562
class User extends Eloquent {
563
563
@@ -572,7 +572,7 @@ class User extends Eloquent {
572
572
And the inverse relation:
573
573
574
574
```php
575
-
use Jenssegers\Mongodb\Model as Eloquent;
575
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
576
576
577
577
class Item extends Eloquent {
578
578
@@ -587,7 +587,7 @@ class Item extends Eloquent {
587
587
The belongsToMany relation will not use a pivot "table", but will push id's to a __related_ids__ attribute instead. This makes the second parameter for the belongsToMany method useless. If you want to define custom keys for your relation, set it to `null`:
588
588
589
589
```php
590
-
use Jenssegers\Mongodb\Model as Eloquent;
590
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
591
591
592
592
class User extends Eloquent {
593
593
@@ -607,7 +607,7 @@ Other relations are not yet supported, but may be added in the future. Read more
607
607
If you want to embed models, rather than referencing them, you can use the `embedsMany` relation. This relation is similar to the `hasMany` relation, but embeds the models inside the parent object.
608
608
609
609
```php
610
-
use Jenssegers\Mongodb\Model as Eloquent;
610
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
0 commit comments