Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!