gurgentil / laravel-eloquent-sequencer

A package that allows you to create and manage sequences on Eloquent models.
MIT License
156 stars 13 forks source link

Unable to disable sequencing when creating a model #11

Closed ehamrin closed 4 years ago

ehamrin commented 4 years ago

It should be possible to disable sequencing when creating a model by calling

(new Model($attributes))
    ->withoutSequencing()
    ->save();

Use case

When migrating data between two systems the order column is already populated and I have no need to recalculate the order.

gurgentil commented 4 years ago

I hope the latest release works for you! :) #15

ehamrin commented 4 years ago

The latest release requires a modification to the global config each time I need to disable a single sequencing for a specific model.

It seems like a better solution to add the following lines to the handleSequencableCreate method like the others:

 if (! $this->shouldBeSequenced) {
     $this->shouldBeSequenced = true;

     return;
}