Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
Multiple Laravel bootable traits not working

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'
        );
    }
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

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

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda