Skip to content

Laravel 13.x Compatibility#148

Merged
tonysm merged 9 commits intotighten:mainfrom
laravel-shift:l13-compatibility
Mar 3, 2026
Merged

Laravel 13.x Compatibility#148
tonysm merged 9 commits intotighten:mainfrom
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
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-shift commented Feb 26, 2026

⚠️ 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/parental.git"
        }
    ]
}

Then update your dependency constraint to reference this branch:

{
    "require": {
        "tightenco/parental": "dev-l13-compatibility",
    }
}

Finally, run: composer update

…dispatching

Since Laravel 13 requires registering model events using the
`whenBooted` callback, the existing `parentIsBooting()` guard was not
catching the double registration, since it would happen after the models
booted lifecycle.

This commit simplify the implementation to checking for the
`bootIfNotBooted` is in the call stack, which covers the entire boot
lifecycle of the model. It also adds an early return when called from
the child class to avoid unnecessary work there.
Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@tonysm tonysm merged commit a1eae70 into tighten:main Mar 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants