Skip to content

Commit 62f6449

Browse files
authored
Merge branch '4.8' into merge-4.7-into-4.8-1724687399102
2 parents efab63b + 500ae9b commit 62f6449

Some content is hidden

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

43 files changed

+807
-486
lines changed

Diff for: CHANGELOG.md

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

4-
## [4.7.2] - coming soon
4+
## [4.8.0] - 2024-08-27
5+
6+
* Add `Query\Builder::incrementEach()` and `decrementEach()` methods by @SmallRuralDog in [#2550](https://github.com/mongodb/laravel-mongodb/pull/2550)
7+
* Add `Query\Builder::whereLike()` and `whereNotLike()` methods by @GromNaN in [#3108](https://github.com/mongodb/laravel-mongodb/pull/3108)
8+
* Deprecate `Connection::collection()` and `Schema\Builder::collection()` methods by @GromNaN in [#3062](https://github.com/mongodb/laravel-mongodb/pull/3062)
9+
* Deprecate `Model::$collection` property to customize collection name. Use `$table` instead by @GromNaN in [#3064](https://github.com/mongodb/laravel-mongodb/pull/3064)
10+
11+
## [4.7.2] - 2024-08-27
512

613
* Add `Query\Builder::upsert()` method with a single document by @GromNaN in [#3100](https://github.com/mongodb/laravel-mongodb/pull/3100)
714

Diff for: docs/eloquent-models/model-class.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Change the Model Collection Name
111111

112112
By default, the model uses the snake case plural form of your model
113113
class name. To change the name of the collection the model uses to retrieve
114-
and save data in MongoDB, override the ``$collection`` property of the model
114+
and save data in MongoDB, override the ``$table`` property of the model
115115
class.
116116

117117
.. note::
@@ -127,7 +127,7 @@ The following example specifies the custom MongoDB collection name,
127127
:emphasize-lines: 9
128128
:dedent:
129129

130-
Without overriding the ``$collection`` property, this model maps to the
130+
Without overriding the ``$table`` property, this model maps to the
131131
``planets`` collection. With the overridden property, the example class stores
132132
the model in the ``celestial_body`` collection.
133133

Diff for: docs/fundamentals/database-collection.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ create a database connection to the ``animals`` database in the
5656

5757
.. code-block:: php
5858
:emphasize-lines: 1,8
59-
59+
6060
'default' => 'mongodb',
6161

6262
'connections' => [
@@ -77,7 +77,7 @@ The following example shows how to specify multiple database connections
7777
``plants`` databases:
7878

7979
.. code-block:: php
80-
80+
8181
'connections' => [
8282

8383
'mongodb' => [
@@ -145,16 +145,22 @@ Laravel retrieves results from the ``flowers`` collection:
145145

146146
Flower::where('name', 'Water Lily')->get()
147147

148+
.. note::
149+
150+
Starting in {+odm-short+} v4.8, the ``DB::collection()`` method
151+
is deprecated. As shown in the following example, you can use the ``DB::table()``
152+
method to access a MongoDB collection.
153+
148154
If you are unable to accomplish your operation by using an Eloquent
149-
model, you can access the query builder by calling the ``collection()``
155+
model, you can access the query builder by calling the ``table()``
150156
method on the ``DB`` facade. The following example shows the same query
151157
as in the preceding example, but the query is constructed by using the
152-
``DB::collection()`` method:
158+
``DB::table()`` method:
153159

154160
.. code-block:: php
155161

156162
DB::connection('mongodb')
157-
->collection('flowers')
163+
->table('flowers')
158164
->where('name', 'Water Lily')
159165
->get()
160166

Diff for: docs/includes/auth/AuthUser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class User extends Authenticatable
88
{
99
protected $connection = 'mongodb';
10-
protected $collection = 'users';
10+
protected $table = 'users';
1111

1212
protected $fillable = [
1313
'name',

Diff for: docs/includes/auth/PersonalAccessToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PersonalAccessToken extends SanctumToken
1010
use DocumentModel;
1111

1212
protected $connection = 'mongodb';
13-
protected $collection = 'personal_access_tokens';
13+
protected $table = 'personal_access_tokens';
1414
protected $primaryKey = '_id';
1515
protected $keyType = 'string';
1616
}

Diff for: docs/includes/eloquent-models/PlanetCollection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
class Planet extends Model
88
{
9-
protected $collection = 'celestial_body';
9+
protected $table = 'celestial_body';
1010
}

Diff for: docs/includes/fundamentals/read-operations/Movie.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
class Movie extends Model
88
{
99
protected $connection = 'mongodb';
10-
protected $collection = 'movies';
10+
protected $table = 'movies';
1111
protected $fillable = ['title', 'year', 'runtime', 'imdb', 'plot'];
1212
}

0 commit comments

Comments
 (0)