yalsicor's avatar

Trait boot method not working on GitHub runner

I came across a weird behavior:

I have a model trait HasSettingsTrait with a boot method that hooks into the model created event:

public static function bootHasSettingsTrait(): void
    {
        static::created(function ($model) {
            $model->setDefaultSettings();
        });
    }

using the model event closures: https://laravel.com/docs/master/eloquent#events-using-closures

Testing this locally works totally fine. But running my tests on a GitHub runner fails because the method never gets called and default settings are not set up.

PHP version on both is 8.1, Laravel Framework 9.52.4.

Any idea on how to debug this? Some funky static binding going on?

0 likes
0 replies

Please or to participate in this conversation.