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
Keep observer methods focused and single-purpose
Avoid heavy operations in frequently called methods
Use queued jobs for time-consuming tasks
Handle exceptions appropriately
Document your observer methods
Last updated