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-13
Original file line number
Diff line number
Diff line change
@@ -107,15 +107,15 @@ Eloquent
107
107
This package includes a MongoDB enabled Eloquent class that you can use to define models for corresponding collections.
108
108
109
109
```php
110
-
use Jenssegers\Mongodb\Model as Eloquent;
110
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
111
111
112
112
class User extends Eloquent {}
113
113
```
114
114
115
115
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:
116
116
117
117
```php
118
-
use Jenssegers\Mongodb\Model as Eloquent;
118
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
119
119
120
120
class User extends Eloquent {
121
121
@@ -127,7 +127,7 @@ class User extends Eloquent {
127
127
**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.
128
128
129
129
```php
130
-
use Jenssegers\Mongodb\Model as Eloquent;
130
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
131
131
132
132
class MyModel extends Eloquent {
133
133
@@ -143,7 +143,7 @@ Everything else works just like the original Eloquent model. Read more about the
143
143
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:
@@ -233,10 +233,10 @@ MongoDB Support => enabled
233
233
234
234
#### Argument 2 passed to Illuminate\Database\Query\Builder::__construct() must be an instance of Illuminate\Database\Query\Grammars\Grammar, null given
235
235
236
-
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:
236
+
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:
237
237
238
238
```php
239
-
use Jenssegers\Mongodb\Model as Eloquent;
239
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
240
240
241
241
class User extends Eloquent {
242
242
@@ -531,7 +531,7 @@ Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate ob
531
531
Example:
532
532
533
533
```php
534
-
use Jenssegers\Mongodb\Model as Eloquent;
534
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
535
535
536
536
class User extends Eloquent {
537
537
@@ -558,7 +558,7 @@ Supported relations are:
558
558
Example:
559
559
560
560
```php
561
-
use Jenssegers\Mongodb\Model as Eloquent;
561
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
562
562
563
563
class User extends Eloquent {
564
564
@@ -573,7 +573,7 @@ class User extends Eloquent {
573
573
And the inverse relation:
574
574
575
575
```php
576
-
use Jenssegers\Mongodb\Model as Eloquent;
576
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
577
577
578
578
class Item extends Eloquent {
579
579
@@ -588,7 +588,7 @@ class Item extends Eloquent {
588
588
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`:
589
589
590
590
```php
591
-
use Jenssegers\Mongodb\Model as Eloquent;
591
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
592
592
593
593
class User extends Eloquent {
594
594
@@ -608,7 +608,7 @@ Other relations are not yet supported, but may be added in the future. Read more
608
608
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.
609
609
610
610
```php
611
-
use Jenssegers\Mongodb\Model as Eloquent;
611
+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
0 commit comments