Using multiple boot traits with the same event will fire just the first one and ignore the rest bootable traits.
class Tag extends Model
{
use HasKey; // this will work (but if i put it bellow it will not work)
use HasSlug; // this's not (but if i put it above it will work)
}
trait HasKey
{
public static function bootHasKey()
{
static::creating(
fn (Model $model) => $model->key = 'value'
);
}
trait HasSlug
{
public static function bootHasSlug()
{
static::creating(
fn (Model $model) => $model->slug = 'value'
);
}
}
I found that it's not supported at the moment, maybe in the future releases of Laravel!
https://github.com/laravel/framework/issues/40645#issuecomment-1022969116