Skip to content

Lifecycle hooks not being executed #8

@jonaaix

Description

@jonaaix

It seems while using this mass-update, the model's lifecycle hooks are not executed.
E.g. while mass updating a sortIndex property in Attachments:

// From Attachments model
use MassUpdatable;

protected static function boot(): void {
  parent::boot();

  static::saved(function ($attachment) {
    $attachment->email->hasSortedAttachments = 1;
    $attachment->email->save();
  });
}

If the saving hook was executed during mass update, the relation email should have hasSortedAttachments = 1, but it remains 0.
This wouldn't be an issue, if the mass update was done using the \DB QueryBuilder, but since it was done using a Model function, it should be honored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions