Skip to content

Commit e82fe60

Browse files
authored
Merge branch '4.2' into merge-4.1-into-4.2-1712583963596
2 parents 2b0b5e6 + 2074da3 commit e82fe60

17 files changed

+361
-35
lines changed

.github/workflows/build-ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ jobs:
2424
- "8.2"
2525
- "8.3"
2626
laravel:
27-
- "10.*"
27+
- "10.*"
28+
- "11.*"
2829
include:
2930
- php: "8.1"
3031
laravel: "10.*"
3132
mongodb: "5.0"
3233
mode: "low-deps"
34+
exclude:
35+
- php: "8.1"
36+
laravel: "11.*"
3337

3438
steps:
3539
- uses: "actions/checkout@v4"
@@ -76,8 +80,7 @@ jobs:
7680
restore-keys: "${{ matrix.os }}-composer-"
7781

7882
- name: "Install dependencies"
79-
run: composer update --no-interaction $([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest --prefer-stable')
80-
83+
run: composer update --no-interaction $([[ "${{ matrix.mode }}" == low-deps ]] && echo ' --prefer-lowest')
8184
- name: "Run tests"
8285
run: "./vendor/bin/phpunit --coverage-clover coverage.xml"
8386
env:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [unreleased]
5+
6+
7+
## [4.2.0] - 2024-12-14
8+
9+
* Add support for Laravel 11 by @GromNaN in [#2735](https://github.com/mongodb/laravel-mongodb/pull/2735)
10+
* Implement Model::createOrFirst() using findOneAndUpdate operation by @GromNaN in [#2742](https://github.com/mongodb/laravel-mongodb/pull/2742)
11+
412
## [4.1.3] - 2024-03-05
513

614
* Fix the timezone of `datetime` fields when they are read from the database. By @GromNaN in [#2739](https://github.com/mongodb/laravel-mongodb/pull/2739)

composer.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@
2424
"require": {
2525
"php": "^8.1",
2626
"ext-mongodb": "^1.15",
27-
"illuminate/support": "^10.0",
28-
"illuminate/container": "^10.0",
29-
"illuminate/database": "^10.30",
30-
"illuminate/events": "^10.0",
27+
"illuminate/support": "^10.0|^11",
28+
"illuminate/container": "^10.0|^11",
29+
"illuminate/database": "^10.30|^11",
30+
"illuminate/events": "^10.0|^11",
3131
"mongodb/mongodb": "^1.15"
3232
},
3333
"require-dev": {
3434
"phpunit/phpunit": "^10.3",
35-
"orchestra/testbench": "^8.0",
35+
"orchestra/testbench": "^8.0|^9.0",
3636
"mockery/mockery": "^1.4.4",
3737
"doctrine/coding-standard": "12.0.x-dev",
3838
"spatie/laravel-query-builder": "^5.6",
3939
"phpstan/phpstan": "^1.10"
4040
},
41+
"minimum-stability": "dev",
4142
"replace": {
4243
"jenssegers/mongodb": "self.version"
4344
},
@@ -66,9 +67,6 @@
6667
"cs:fix": "phpcbf"
6768
},
6869
"config": {
69-
"platform": {
70-
"php": "8.1"
71-
},
7270
"allow-plugins": {
7371
"dealerdirect/phpcodesniffer-composer-installer": true
7472
}

docs/includes/framework-compatibility-laravel.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
:stub-columns: 1
44

55
* - {+odm-short+} Version
6+
- Laravel 11.x
67
- Laravel 10.x
78
- Laravel 9.x
89

10+
* - 4.2
11+
- ✓
12+
- ✓
13+
-
14+
915
* - 4.1
16+
-
1017
- ✓
1118
-
1219

1320
* - 4.0
21+
-
1422
- ✓
1523
-
1624

docs/quick-start.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ that connects to a MongoDB deployment.
5353
.. tip::
5454

5555
You can download the complete web application project by cloning the
56-
`laravel-quickstart <https://github.com/mongodb-university/laravel-quickstart>`__
56+
`laravel-quickstart <https://github.com/mongodb-university/laravel-quickstart/>`__
5757
GitHub repository.
5858

5959
.. button:: Next: Download and Install

docs/quick-start/configure-mongodb.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ Configure Your MongoDB Connection
4141

4242
// ...
4343

44-
.. step:: Add the Laravel MongoDB provider
44+
.. step:: Add the MongoDB provider
4545

46-
Open the ``app.php`` file in the ``config`` directory and
47-
add the following entry into the ``providers`` array:
46+
Open the ``providers.php`` file in the ``bootstrap`` directory and add
47+
the following entry into the array:
4848

4949
.. code-block::
5050

5151
MongoDB\Laravel\MongoDBServiceProvider::class,
5252

53+
.. tip::
54+
55+
To learn how to register the provider in Laravel 10.x, see
56+
`Registering Providers <https://laravel.com/docs/10.x/providers#registering-providers>`__.
57+
5358
After completing these steps, your Laravel web application is ready to
5459
connect to MongoDB.
5560

docs/quick-start/view-data.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ View MongoDB Data
6767

6868
public function show()
6969
{
70-
return view('browse_movies', [
71-
'movies' => Movie::where('runtime', '<', 60)
72-
->where('imdb.rating', '>', 8.5)
73-
->orderBy('imdb.rating', 'desc')
74-
->take(10)
75-
->get()
76-
]);
70+
return view('browse_movies', [
71+
'movies' => Movie::where('runtime', '<', 60)
72+
->where('imdb.rating', '>', 8.5)
73+
->orderBy('imdb.rating', 'desc')
74+
->take(10)
75+
->get()
76+
]);
7777
}
7878

7979
.. step:: Add a web route

docs/quick-start/write-data.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ Write Data to MongoDB
3232

3333
.. step:: Add an API route that calls the controller function
3434

35+
Generate an API route file by running the following command:
36+
37+
.. code-block:: bash
38+
39+
php artisan install:api
40+
41+
.. tip::
42+
43+
Skip this step if you are using Laravel 10.x because the file that
44+
the command generates already exists.
45+
3546
Import the controller and add an API route that calls the ``store()``
3647
method in the ``routes/api.php`` file:
3748

@@ -42,7 +53,7 @@ Write Data to MongoDB
4253
// ...
4354

4455
Route::resource('movies', MovieController::class)->only([
45-
'store'
56+
'store'
4657
]);
4758

4859

@@ -57,8 +68,8 @@ Write Data to MongoDB
5768

5869
class Movie extends Model
5970
{
60-
protected $connection = 'mongodb';
61-
protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot'];
71+
protected $connection = 'mongodb';
72+
protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot'];
6273
}
6374

6475
.. step:: Post a request to the API

docs/retrieve.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ documents.
265265
Runtime: 95
266266
IMDB Rating: 4
267267
IMDB Votes: 9296
268-
Plot: A sci-fi update of the famous 6th Century poem. In a beseiged land, Beowulf must
268+
Plot: A sci-fi update of the famous 6th Century poem. In a besieged land, Beowulf must
269269
battle against the hideous creature Grendel and his vengeance seeking mother.
270270

271271
.. _laravel-retrieve-one:

src/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ private static function lookupVersion(): string
328328
try {
329329
return self::$version = InstalledVersions::getPrettyVersion('mongodb/laravel-mongodb');
330330
} catch (Throwable) {
331-
// Ignore exceptions and return unknown version
331+
return self::$version = 'error';
332332
}
333333
}
334334

0 commit comments

Comments
 (0)