Skip to content

Fire events/allow observers on pivot models #4022

Closed
@jfexyz

Description

@jfexyz

For pivot models, model events are not fired, nor can you register observables. I'm primarily talking about any relationship that requires a pivot table, and therefore extends Pivot. There was a previous pull request, but I don't believe the workaround there will work for pivots.

If events are fired, we'd also need to be able to register observers against pivots, but that's not currently possible because Pivots can't be instantiated by themselves. (In my case, I'd like to track which user updates a model (including pivots). Am I missing something, or could Illuminate\Database\Eloquent\Model::getObservableEvents() be a static method, thereby avoiding the second issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions