Skip to content

Commit 0e9fc93

Browse files
committed
Rename project
1 parent e7d4034 commit 0e9fc93

File tree

88 files changed

+264
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+264
-316
lines changed

.github/FUNDING.yml

-2
This file was deleted.

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
## [Unreleased]
4+
## [4.0.0] - unreleased
55

6+
- Rename package to `mongodb/laravel-eloquent`
7+
- Change namespace to `Mongodb\Laravel`
68
- Add classes to cast `ObjectId` and `UUID` instances [#1](https://github.com/GromNaN/laravel-mongodb-private/pull/1) by [@alcaeus](https://github.com/alcaeus).
79
- Add `Query\Builder::toMql()` to simplify comprehensive query tests [#6](https://github.com/GromNaN/laravel-mongodb-private/pull/6) by [@GromNaN](https://github.com/GromNaN).
810
- Fix `Query\Builder::whereNot` to use MongoDB [`$not`](https://www.mongodb.com/docs/manual/reference/operator/query/not/) operator [#13](https://github.com/GromNaN/laravel-mongodb-private/pull/13) by [@GromNaN](https://github.com/GromNaN).

CODE_OF_CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
3939

4040
## Enforcement
4141

42-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hello@jenssegers.com. All complaints will be reviewed and investigated promptly and fairly.
42+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at community-conduct@mongodb.com. All complaints will be reviewed and investigated promptly and fairly.
4343

4444
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
4545

@@ -81,4 +81,4 @@ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcem
8181
[homepage]: https://www.contributor-covenant.org
8282

8383
For answers to common questions about this code of conduct, see the FAQ at
84-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
84+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Jens Segers
3+
Copyright (c) 2023 MongoDB Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+31-78
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
Laravel MongoDB
22
===============
33

4-
[![Latest Stable Version](http://img.shields.io/github/release/jenssegers/laravel-mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb)
5-
[![Total Downloads](http://img.shields.io/packagist/dm/jenssegers/mongodb.svg)](https://packagist.org/packages/jenssegers/mongodb)
6-
[![Build Status](https://img.shields.io/github/workflow/status/jenssegers/laravel-mongodb/CI)](https://github.com/jenssegers/laravel-mongodb/actions)
7-
[![codecov](https://codecov.io/gh/jenssegers/laravel-mongodb/branch/master/graph/badge.svg)](https://codecov.io/gh/jenssegers/laravel-mongodb/branch/master)
8-
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.me/jenssegers)
4+
[![Latest Stable Version](http://img.shields.io/github/release/mongodb/laravel-eloquent.svg)](https://packagist.org/packages/mongodb/laravel-eloquent)
5+
[![Total Downloads](http://img.shields.io/packagist/dm/mongodb/laravel-eloquent.svg)](https://packagist.org/packages/mongodb/laravel-eloquent)
6+
[![Build Status](https://img.shields.io/github/workflow/status/mongodb/laravel-eloquent/CI)](https://github.com/mongodb/laravel-eloquent/actions)
7+
[![codecov](https://codecov.io/gh/mongodb/laravel-eloquent/branch/master/graph/badge.svg)](https://codecov.io/gh/mongodb/laravel-eloquent/branch/master)
98

109
This package adds functionalities to the Eloquent model and Query builder for MongoDB, using the original Laravel API. *This library extends the original Laravel classes, so it uses exactly the same methods.*
1110

@@ -46,8 +45,6 @@ This package adds functionalities to the Eloquent model and Query builder for Mo
4645
- [Cross-Database Relationships](#cross-database-relationships)
4746
- [Authentication](#authentication)
4847
- [Queues](#queues)
49-
- [Laravel specific](#laravel-specific)
50-
- [Lumen specific](#lumen-specific)
5148
- [Upgrading](#upgrading)
5249
- [Upgrading from version 2 to 3](#upgrading-from-version-2-to-3)
5350
- [Security contact information](#security-contact-information)
@@ -79,23 +76,23 @@ Make sure you have the MongoDB PHP driver installed. You can find installation i
7976
Install the package via Composer:
8077

8178
```bash
82-
$ composer require jenssegers/mongodb
79+
$ composer require mongodb/laravel-eloquent
8380
```
8481

8582
### Laravel
8683

8784
In case your Laravel version does NOT autoload the packages, add the service provider to `config/app.php`:
8885

8986
```php
90-
Jenssegers\Mongodb\MongodbServiceProvider::class,
87+
MongoDB\Laravel\MongodbServiceProvider::class,
9188
```
9289

9390
### Lumen
9491

9592
For usage with [Lumen](http://lumen.laravel.com), add the service provider in `bootstrap/app.php`. In this file, you will also need to enable Eloquent. You must however ensure that your call to `$app->withEloquent();` is **below** where you have registered the `MongodbServiceProvider`:
9693

9794
```php
98-
$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
95+
$app->register(MongoDB\Laravel\MongodbServiceProvider::class);
9996

10097
$app->withEloquent();
10198
```
@@ -112,7 +109,7 @@ For usage outside Laravel, check out the [Capsule manager](https://github.com/il
112109
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name) {
113110
$config['name'] = $name;
114111

115-
return new Jenssegers\Mongodb\Connection($config);
112+
return new MongoDB\Laravel\Connection($config);
116113
});
117114
```
118115

@@ -186,7 +183,7 @@ Eloquent
186183
This package includes a MongoDB enabled Eloquent class that you can use to define models for corresponding collections.
187184

188185
```php
189-
use Jenssegers\Mongodb\Eloquent\Model;
186+
use MongoDB\Laravel\Eloquent\Model;
190187

191188
class Book extends Model
192189
{
@@ -199,7 +196,7 @@ Just like a normal model, the MongoDB model class will know which collection to
199196
To change the collection, pass the `$collection` property:
200197

201198
```php
202-
use Jenssegers\Mongodb\Eloquent\Model;
199+
use MongoDB\Laravel\Eloquent\Model;
203200

204201
class Book extends Model
205202
{
@@ -210,7 +207,7 @@ class Book extends Model
210207
**NOTE:** MongoDB documents are automatically stored with a unique ID that is stored in the `_id` property. If you wish to use your own ID, substitute the `$primaryKey` property and set it to your own primary key attribute name.
211208

212209
```php
213-
use Jenssegers\Mongodb\Eloquent\Model;
210+
use MongoDB\Laravel\Eloquent\Model;
214211

215212
class Book extends Model
216213
{
@@ -224,7 +221,7 @@ Book::create(['id' => 1, 'title' => 'The Fault in Our Stars']);
224221
Likewise, you may define a `connection` property to override the name of the database connection that should be used when utilizing the model.
225222

226223
```php
227-
use Jenssegers\Mongodb\Eloquent\Model;
224+
use MongoDB\Laravel\Eloquent\Model;
228225

229226
class Book extends Model
230227
{
@@ -234,10 +231,10 @@ class Book extends Model
234231

235232
### Extending the Authenticatable base model
236233

237-
This package includes a MongoDB Authenticatable Eloquent class `Jenssegers\Mongodb\Auth\User` that you can use to replace the default Authenticatable class `Illuminate\Foundation\Auth\User` for your `User` model.
234+
This package includes a MongoDB Authenticatable Eloquent class `MongoDB\Laravel\Auth\User` that you can use to replace the default Authenticatable class `Illuminate\Foundation\Auth\User` for your `User` model.
238235

239236
```php
240-
use Jenssegers\Mongodb\Auth\User as Authenticatable;
237+
use MongoDB\Laravel\Auth\User as Authenticatable;
241238

242239
class User extends Authenticatable
243240
{
@@ -249,10 +246,10 @@ class User extends Authenticatable
249246

250247
When soft deleting a model, it is not actually removed from your database. Instead, a deleted_at timestamp is set on the record.
251248

252-
To enable soft deletes for a model, apply the `Jenssegers\Mongodb\Eloquent\SoftDeletes` Trait to the model:
249+
To enable soft deletes for a model, apply the `MongoDB\Laravel\Eloquent\SoftDeletes` Trait to the model:
253250

254251
```php
255-
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
252+
use MongoDB\Laravel\Eloquent\SoftDeletes;
256253

257254
class User extends Model
258255
{
@@ -274,7 +271,7 @@ Keep in mind guarding still works, but you may experience unexpected behavior.
274271
Eloquent allows you to work with Carbon or DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database.
275272

276273
```php
277-
use Jenssegers\Mongodb\Eloquent\Model;
274+
use MongoDB\Laravel\Eloquent\Model;
278275

279276
class User extends Model
280277
{
@@ -812,7 +809,7 @@ The MongoDB-specific relationships are:
812809
Here is a small example:
813810

814811
```php
815-
use Jenssegers\Mongodb\Eloquent\Model;
812+
use MongoDB\Laravel\Eloquent\Model;
816813

817814
class User extends Model
818815
{
@@ -826,7 +823,7 @@ class User extends Model
826823
The inverse relation of `hasMany` is `belongsTo`:
827824

828825
```php
829-
use Jenssegers\Mongodb\Eloquent\Model;
826+
use MongoDB\Laravel\Eloquent\Model;
830827

831828
class Item extends Model
832829
{
@@ -844,7 +841,7 @@ The belongsToMany relation will not use a pivot "table" but will push id's to a
844841
If you want to define custom keys for your relation, set it to `null`:
845842

846843
```php
847-
use Jenssegers\Mongodb\Eloquent\Model;
844+
use MongoDB\Laravel\Eloquent\Model;
848845

849846
class User extends Model
850847
{
@@ -864,7 +861,7 @@ If you want to embed models, rather than referencing them, you can use the `embe
864861
**REMEMBER**: These relations return Eloquent collections, they don't return query builder objects!
865862

866863
```php
867-
use Jenssegers\Mongodb\Eloquent\Model;
864+
use MongoDB\Laravel\Eloquent\Model;
868865

869866
class User extends Model
870867
{
@@ -936,7 +933,7 @@ $user->save();
936933
Like other relations, embedsMany assumes the local key of the relationship based on the model name. You can override the default local key by passing a second argument to the embedsMany method:
937934

938935
```php
939-
use Jenssegers\Mongodb\Eloquent\Model;
936+
use MongoDB\Laravel\Eloquent\Model;
940937

941938
class User extends Model
942939
{
@@ -954,7 +951,7 @@ Embedded relations will return a Collection of embedded items instead of a query
954951
The embedsOne relation is similar to the embedsMany relation, but only embeds a single model.
955952

956953
```php
957-
use Jenssegers\Mongodb\Eloquent\Model;
954+
use MongoDB\Laravel\Eloquent\Model;
958955

959956
class Book extends Model
960957
{
@@ -1156,14 +1153,14 @@ If you're using a hybrid MongoDB and SQL setup, you can define relationships acr
11561153

11571154
The model will automatically return a MongoDB-related or SQL-related relation based on the type of the related model.
11581155

1159-
If you want this functionality to work both ways, your SQL-models will need to use the `Jenssegers\Mongodb\Eloquent\HybridRelations` trait.
1156+
If you want this functionality to work both ways, your SQL-models will need to use the `MongoDB\Laravel\Eloquent\HybridRelations` trait.
11601157

11611158
**This functionality only works for `hasOne`, `hasMany` and `belongsTo`.**
11621159

11631160
The MySQL model should use the `HybridRelations` trait:
11641161

11651162
```php
1166-
use Jenssegers\Mongodb\Eloquent\HybridRelations;
1163+
use MongoDB\Laravel\Eloquent\HybridRelations;
11671164

11681165
class User extends Model
11691166
{
@@ -1181,7 +1178,7 @@ class User extends Model
11811178
Within your MongoDB model, you should define the relationship:
11821179

11831180
```php
1184-
use Jenssegers\Mongodb\Eloquent\Model;
1181+
use MongoDB\Laravel\Eloquent\Model;
11851182

11861183
class Message extends Model
11871184
{
@@ -1199,7 +1196,7 @@ class Message extends Model
11991196
If you want to use Laravel's native Auth functionality, register this included service provider:
12001197

12011198
```php
1202-
Jenssegers\Mongodb\Auth\PasswordResetServiceProvider::class,
1199+
MongoDB\Laravel\Auth\PasswordResetServiceProvider::class,
12031200
```
12041201

12051202
This service provider will slightly modify the internal DatabaseReminderRepository to add support for MongoDB based password reminders.
@@ -1234,63 +1231,19 @@ If you want to use MongoDB to handle failed jobs, change the database in `config
12341231
],
12351232
```
12361233

1237-
#### Laravel specific
1238-
12391234
Add the service provider in `config/app.php`:
12401235

12411236
```php
1242-
Jenssegers\Mongodb\MongodbQueueServiceProvider::class,
1243-
```
1244-
1245-
#### Lumen specific
1246-
1247-
With [Lumen](http://lumen.laravel.com), add the service provider in `bootstrap/app.php`. You must however ensure that you add the following **after** the `MongodbServiceProvider` registration.
1248-
1249-
```php
1250-
$app->make('queue');
1251-
1252-
$app->register(Jenssegers\Mongodb\MongodbQueueServiceProvider::class);
1237+
MongoDB\Laravel\MongodbQueueServiceProvider::class,
12531238
```
12541239

12551240
Upgrading
12561241
---------
12571242

1258-
#### Upgrading from version 2 to 3
1259-
1260-
In this new major release which supports the new MongoDB PHP extension, we also moved the location of the Model class and replaced the MySQL model class with a trait.
1261-
1262-
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files or your registered alias.
1263-
1264-
```php
1265-
use Jenssegers\Mongodb\Eloquent\Model;
1266-
1267-
class User extends Model
1268-
{
1269-
//
1270-
}
1271-
```
1243+
#### Upgrading from version 3 to 4
12721244

1273-
If you are using hybrid relations, your MySQL classes should now extend the original Eloquent model class `Illuminate\Database\Eloquent\Model` instead of the removed `Jenssegers\Eloquent\Model`.
1274-
1275-
Instead use the new `Jenssegers\Mongodb\Eloquent\HybridRelations` trait. This should make things more clear as there is only one single model class in this package.
1276-
1277-
```php
1278-
use Jenssegers\Mongodb\Eloquent\HybridRelations;
1279-
1280-
class User extends Model
1281-
{
1282-
1283-
use HybridRelations;
1284-
1285-
protected $connection = 'mysql';
1286-
}
1287-
```
1288-
1289-
Embedded relations now return an `Illuminate\Database\Eloquent\Collection` rather than a custom Collection class. If you were using one of the special methods that were available, convert them to Collection operations.
1290-
1291-
```php
1292-
$books = $user->books()->sortBy('title')->get();
1293-
```
1245+
Change project name in composer.json to `mongodb/laravel` and run `composer update`.
1246+
Change namespace from `Jenssegers\Mongodb` to `MongoDB\Laravel` in your models and config.
12941247

12951248
## Security contact information
12961249

composer.json

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
2-
"name": "jenssegers/mongodb",
3-
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
2+
"name": "mongodb/laravel-eloquent",
3+
"description": "A MongoDB based Eloquent model and Query builder for Laravel",
44
"keywords": [
55
"laravel",
66
"eloquent",
77
"mongodb",
88
"mongo",
99
"database",
10-
"model",
11-
"moloquent"
10+
"model"
1211
],
13-
"homepage": "https://github.com/jenssegers/laravel-mongodb",
12+
"homepage": "https://github.com/mongodb/laravel-eloquent",
1413
"authors": [
1514
{
1615
"name": "Jens Segers",
@@ -34,23 +33,19 @@
3433
},
3534
"autoload": {
3635
"psr-4": {
37-
"Jenssegers\\Mongodb\\": "src/"
36+
"MongoDB\\Laravel\\": "src/"
3837
}
3938
},
4039
"autoload-dev": {
4140
"psr-4": {
42-
"Jenssegers\\Mongodb\\Tests\\": "tests/"
41+
"MongoDB\\Laravel\\Tests\\": "tests/"
4342
}
4443
},
45-
"suggest": {
46-
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
47-
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
48-
},
4944
"extra": {
5045
"laravel": {
5146
"providers": [
52-
"Jenssegers\\Mongodb\\MongodbServiceProvider",
53-
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
47+
"MongoDB\\Laravel\\MongodbServiceProvider",
48+
"MongoDB\\Laravel\\MongodbQueueServiceProvider"
5449
]
5550
}
5651
},

src/Auth/DatabaseTokenRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Jenssegers\Mongodb\Auth;
3+
namespace MongoDB\Laravel\Auth;
44

55
use DateTime;
66
use DateTimeZone;

src/Auth/PasswordBrokerManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Jenssegers\Mongodb\Auth;
3+
namespace MongoDB\Laravel\Auth;
44

55
use Illuminate\Auth\Passwords\PasswordBrokerManager as BasePasswordBrokerManager;
66

0 commit comments

Comments
 (0)