Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 89463b0

Browse files
authored
Create DocumentModel trait to enable MongoDB on any 3rd party model class (#2580)
* Create DocumentModel trait to enable MongoDB on any 3rd party model class * Use the trait for every test model * Add method Model::isDocumentModel to check when model classes can be used with MongoDB * Refactor the User class to extend Laravel's User class
1 parent ffacc6b commit 89463b0

40 files changed

+1086
-887
lines changed

‎CHANGELOG.md

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

4-
## [4.5.0] - upcoming
4+
## [4.6.0] - upcoming
55

6-
* Add GridFS integration for Laravel File Storage by @GromNaN in [#2984](https://github.com/mongodb/laravel-mongodb/pull/2985)
6+
* Add `DocumentTrait` to use any 3rd party model with MongoDB @GromNaN in [#2580](https://github.com/mongodb/laravel-mongodb/pull/2580)
7+
8+
## [4.5.0] - 2024年06月20日
9+
10+
* Add GridFS integration for Laravel File Storage by @GromNaN in [#2985](https://github.com/mongodb/laravel-mongodb/pull/2985)
711

812
## [4.4.0] - 2024年05月31日
913

‎phpstan-baseline.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ parameters:
77

88
-
99
message: "#^Method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:push\\(\\) invoked with 3 parameters, 0 required\\.$#"
10-
count: 2
10+
count: 3
1111
path: src/Relations/BelongsToMany.php
1212

1313
-
1414
message: "#^Method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:push\\(\\) invoked with 3 parameters, 0 required\\.$#"
15-
count: 2
15+
count: 6
1616
path: src/Relations/MorphToMany.php
1717

1818
-

‎src/Auth/User.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,13 @@
44

55
namespace MongoDB\Laravel\Auth;
66

7-
use Illuminate\Auth\Authenticatable;
8-
use Illuminate\Auth\MustVerifyEmail;
9-
use Illuminate\Auth\Passwords\CanResetPassword;
10-
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
11-
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
12-
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
13-
use Illuminate\Foundation\Auth\Access\Authorizable;
14-
use MongoDB\Laravel\Eloquent\Model;
7+
use Illuminate\Foundation\Auth\User as BaseUser;
8+
use MongoDB\Laravel\Eloquent\DocumentModel;
159

16-
class User extends Model implements
17-
AuthenticatableContract,
18-
AuthorizableContract,
19-
CanResetPasswordContract
10+
class User extends BaseUser
2011
{
21-
use Authenticatable;
22-
use Authorizable;
23-
use CanResetPassword;
24-
use MustVerifyEmail;
12+
use DocumentModel;
13+
14+
protected$primaryKey = '_id';
15+
protected$keyType = 'string';
2516
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /