# How use Laravel's Bootable Eloquent Traits

> Learn how to use Laravel's Bootable Eloquent Traits to register observers without colliding with an existing boot methods.

- URL: https://graffino.com/til/how-use-laravels-bootable-eloquent-traits
- Author: Denisa Halmaghi
- Channel: laravel
- Published: 2021-12-10
- Updated: 2026-09-03

Given the following bootable trait:
```php
trait WithCreator
{
    //no need to define a 'boot' method
    public static function bootWithCreator()
    {
        self::observe(CreatorObserver::class);
    }
}
```

```php
class CreatorObserver
{
    public function creating($model)
    {
        $model->creator()->associate(auth()->user());
    }
}
```

We can use it to register the observer without colliding with existing boot methods inside the model.

```php
class Comment extends Model
{
    use HasFactory;
    use WithCreator;
    
    public static function boot()
    {
        ...
    }
}
```
