cloudcake / laravel-approval

Attach an approval process to any model, approve and disapprove from any other model, for Laravel.
MIT License
140 stars 15 forks source link

FatalErrorException when setting $deleteWhenApproved in model #11

Closed huge10 closed 2 years ago

huge10 commented 4 years ago

Stephen, here is one more issue I'm encountering. Might be just me being stupid, but when I use the RequiresApproval trait on a model and set $deleteWhenApproved to false (so different from the default) I get:

App\ModelName and Approval\Traits\RequiresApproval define the same property ($deleteWhenApproved) in the composition of App\ModelName. However, the definition differs and is considered incompatible. Class was composed

Using Laravel 5.8

huge10 commented 4 years ago

I'm now doing this, btw: https://stackoverflow.com/a/38558480 (but feels wrong to add an extra model abstract layer just for this purpose)

stephenlake commented 4 years ago

I'm a little snowed in with an upcoming project deadline. You can blame my laziness in not covering use cases in unit tests. Suppose a quick fix would be to apply static modifiers to all properties, but I'm not really in a position to be making changes here right now, nevermind even responding to issues. You're more than welcome to submit a PR though.

Domenikus commented 3 years ago

Having the same issue, you can override it in the model constructur, it's not a perfect solution but it works