Skip to content

Laravel 13.x Compatibility#3482

Merged
GromNaN merged 9 commits intomongodb:5.xfrom
laravel-shift:l13-compatibility
Mar 20, 2026
Merged

Laravel 13.x Compatibility#3482
GromNaN merged 9 commits intomongodb:5.xfrom
laravel-shift:l13-compatibility

Conversation

@laravel-shift
Copy link
Contributor

This is an automated pull request from Shift to update your package code and dependencies to be compatible with Laravel 13.x.

Before merging, you need to:

  • Checkout the l13-compatibility branch
  • Review all comments for additional changes
  • Thoroughly test your package

If you do find an issue, please report it by commenting on this PR to help improve future automation.

@laravel-shift laravel-shift requested a review from a team as a code owner March 5, 2026 12:23
@laravel-shift laravel-shift requested a review from paulinevos March 5, 2026 12:23
@laravel-shift
Copy link
Contributor Author

⚠️ The latest version of Laravel has a dependency for phpunit/phpunit of ^12.5. If you would like to also upgrade your tests, you may run the PHPUnit 12 Shift for free.

@laravel-shift
Copy link
Contributor Author

⚠️ Shift detected GitHub Actions which run jobs using a version matrix. Shift attempted to update your configuration for Laravel 13. However, you should review these changes to ensure the desired combination of versions are built for your package.

@laravel-shift
Copy link
Contributor Author

⚠️ Laravel 13 now throws a LogicException if you attempt to create new instances or register observer events while booting models. Instead, you must wrap this code within a whenBooted callback.

For example:

static::whenBooted(fn () => static::observe(new ModelObserver));

Shift found boot methods within the following files. You should review the code within these methods and update it to use the whenBooted callback if necessary.

@laravel-shift
Copy link
Contributor Author

⚗️ Using this package? If you would like to help test these changes or believe them to be compatible, you may update your project to reference this branch.

To do so, temporarily add Shift's fork to the repositories property of your composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/laravel-shift/laravel-mongodb.git"
        }
    ]
}

Then update your dependency constraint to reference this branch:

{
    "require": {
        "mongodb/laravel-mongodb": "dev-l13-compatibility",
    }
}

Finally, run: composer update

@github-actions github-actions bot added the github label Mar 5, 2026
@GromNaN GromNaN self-assigned this Mar 18, 2026
@GromNaN
Copy link
Member

GromNaN commented Mar 20, 2026

I can't reproduce the test failure locally.

1) MongoDB\Laravel\Tests\ModelTest::testCreateWithNullId#0 with data ('_id')
Failed asserting that 2 is identical to 1.

/home/runner/work/laravel-mongodb/laravel-mongodb/tests/ModelTest.php:1322

@GromNaN GromNaN force-pushed the l13-compatibility branch from fa141e5 to 90881a7 Compare March 20, 2026 09:39
@GromNaN GromNaN force-pushed the l13-compatibility branch from 90881a7 to 657c138 Compare March 20, 2026 10:09
@GromNaN GromNaN added feature and removed github labels Mar 20, 2026
@GromNaN GromNaN enabled auto-merge (squash) March 20, 2026 10:59
@GromNaN GromNaN merged commit 70079c2 into mongodb:5.x Mar 20, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants