Available Methods

Laravel Dynamic Observer supports all standard Laravel model observer methods. Here's a comprehensive list of available methods and their use cases.

Core Methods

Creating & Created

public function creating(Model $model)
{
    // Called before a new model is created
    // Perfect for modifying attributes before save
}

public function created(Model $model)
{
    // Called after a new model is created
    // Ideal for additional operations after creation
}

Updating & Updated

public function updating(Model $model)
{
    // Called before an existing model is updated
    // Use for validation or attribute modification
}

public function updated(Model $model)
{
    // Called after an existing model is updated
    // Perfect for triggering additional updates
}

Saving & Saved

Deleting & Deleted

Soft Deletes

Retrieved

Best Practices

  1. Keep observer methods focused and single-purpose

  2. Avoid heavy operations in frequently called methods

  3. Use queued jobs for time-consuming tasks

  4. Handle exceptions appropriately

  5. Document your observer methods

Last updated